Docker Community Forums

Share and learn in the Docker community.

Handling Dev/Test/Production specific configuration in Docker


(Jobritton) #1

I’m In the midst of dockerizing our development environment and I’m trying to envision how this will push forward into our test and production environments. It doesn’t feel quite right baking environment specific configuration into the images, as I would believe you’d want to roll the same image you tested in Dev to QA & Production. This would then leave you with creating more vanilla main stream images that would need the environment specific configuration injected via a startup script of sorts? Am I on the right path or what is the recommended approach? Thanks!

Jason


(Sabin Basyal) #2

Conceptually, it looks good.
You may also utilize --env-file=[] with your docker run command, which reads in a line delimited file of environment variables. These files would be specific to your environment that you may fetch from private repository or anywhere secure.


(Jobritton) #3

Thanks for the reply Sabin. After doing some more reading and searching around it seems the use of wrapper scripts to do configuration/environment specific items and then launch your intended process with exec are not uncommon so that’s how I’m proceeding. I’ve set an ENTRYPOINT that is a shell script for configuring the target environment and this shell script is passed parameters by the docker run command to indicate what configuration changes are needed (beyond setting environment variables). After the config changes are made, exec is called to launch tomcat.


(Sabin Basyal) #4

Looks good! :thumbsup: