官术网_书友最值得收藏!

Managing application configuration

The goal of packaging applications in Docker images is to use the same image in every environment. You don't build separate images for test and production, because that would make them separate apps and there could be inconsistencies between them. You should deploy your production app from the exact same Docker image that was tested by the users, which is the exact same image generated by the build process and used for all of your automated integration tests.

Of course, some things need to change between environments – connection strings for the database, logging level, and feature switches. This is application configuration, and in the Docker world you build your application image with a default set of configuration, typically for the development environment.  At runtime you inject the correct configuration for the current environment into the container, and that overwrites the default configuration.

There are different approaches to injecting this configuration. In this chapter I'll show you how to use volume mounts and environment variables. In production, you'll be running a cluster of machines running Docker, and you can store configuration data in the cluster's secure database, as Docker config objects or Docker secrets. I'll cover this in Chapter 7, Orchestrating Distributed Solutions with Docker Swarm.

主站蜘蛛池模板: 安阳县| 新余市| 双鸭山市| 雷波县| 丰原市| 喀喇| 乡城县| 宜黄县| 静安区| 韩城市| 襄汾县| 梓潼县| 南陵县| 高尔夫| 长白| 莱州市| 义乌市| 文昌市| 南郑县| 裕民县| 沧源| 浑源县| 昌江| 瓮安县| 江西省| 永康市| 文水县| 湾仔区| 铜鼓县| 伊吾县| 通海县| 兴城市| 淮安市| 改则县| 密云县| 鄂州市| 勐海县| 土默特左旗| 固镇县| 三穗县| 汽车|