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

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.

主站蜘蛛池模板: 吉林市| 合江县| 山丹县| 临泉县| 阳信县| 清水河县| 二手房| 马尔康县| 郓城县| 民勤县| 南通市| 甘肃省| 永泰县| 桃源县| 航空| 吉林市| 淮北市| 元朗区| 那曲县| 大同县| 额尔古纳市| 澎湖县| 仪征市| 商丘市| 铅山县| 漯河市| 深圳市| 垦利县| 台前县| 衡东县| 南木林县| 山西省| 揭西县| 平顶山市| 武汉市| 哈巴河县| 新乐市| 读书| 揭西县| 曲阳县| 个旧市|