What is the best way to manage application configuration for Docker container?
Hello there
We use several services, built in several languages by different people, and have tried several approaches, with different success and pain points :
Build a Docker image by environment (ie your build script select the right config for the given environment)
Build a single image, with a default config, and override some settings with environment variables at runtime
Build a single image with all the config for the various environments/flags and set the environment (or a given flag) from the environment variable
Build a single image with a default config for all environment, from a template, and use some key/value agent to live-update the config/templates. We've used this to easily update NGINx configs without requiring any new image build or restart. Have a Consul agent running on each instance, and using consul template, we could easily set complex key/values on a given stack and automatically applies these update in the config files (regenerated on the fly in the image)
These are the ones we tried, and there's many more variations. But that should help you getting started. If I were you, I would start trying to list my config management requirements:
Hope this helps,
Jan Vladimir Mostert
Idea Incubator
Add all your configs to the app in config files and use environment variables to switch between configs.