Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

301
Views
What are the benefits of docker config over setting environment variables for containers?

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?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

There are many, but it's mainly a matter of choice. Here are some benefits:

  • Docker config are immutable, where environment variable are not (this one may be both a benefit and drawback though)
  • Docker config are easily manageable with docker config commands where environment variables are not
  • Environment variables may collide in your container: you may use environment variable MONGODB_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 runtime
  • Config file may have restricted read permission (i.e. only the applicative user may read it), where environment variable may leak to a sub-process or anyone accessing your container
  • Config file may be splitted in several parts for readability or management in your container, environment variables cannot
  • When checking what are your effective container configuration (i.e. running a shell in your container and looking around), using config file is much easier than showing a bunch of potentially unrelated environment variables (cat myconfig VS. env)
  • In summary, config file are more partitioned and manageable than environment variables

You may take a look at this post which is not Docker specific but may give some insights.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!