Reputation: 2331
Both Docker config and setting environment variables for containers seems to accomplish the same goals. Especially when considering the environment variables to set can get fetched from a file (env_file).
What are the benefits of docker config over setting environment variables for containers?
Upvotes: 4
Views: 1463
Reputation: 12933
There are many, but it's mainly a matter of choice. Here are some benefits:
docker config
commands where environment variables are notMONGODB_HOST=mongodb://foo:bar@my-mongo:27017
pointing to Mongo database but a library you are using in your application will also use this variable but expect a simple hostname such as my-mongo
and throw an exception at runtimecat myconfig
VS. env
)You may take a look at this post which is not Docker specific but may give some insights.
Upvotes: 6