Docker Community Forums

Share and learn in the Docker community.

Where to put configurations? .env-file vs. Dockerfile vs. entrypoint.sh


(Konstantin) #1

Hi there,

currently I’m wondering where I should do the configuration of services. For example: I’m building a mailserver containing everything needed to run a fully-featured mailserver. I’m doing the initial configuration of DB users, primary domain and other stuff in an env file which is read in every service in my docker-compose.yml. In this way I can get the env variables via “set -e” in the entrypoint.sh which I also use in every service. So currently copying all service files to the image with placeholders (e.g. for postfix %MYSQL_MAIL_USER%) and then I replace these placeholders in the entrypoint.sh with the corresponding env variables. But is this the “right” way? Or would it be better to put these kind of configuration including password in the image? How are you doing it?