Docker Community Forums

Share and learn in the Docker community.

Passing multiple env-files in docker-run command


(Nitinayyagari) #1

Docker documentation says we need to use something like the below one, for passing a file env.list which has several environment variables in it. How can we pass more than one environment file, say env.list and newenv.list
$ docker run --env-file ./env.list ubuntu bash


(Fauzan Ariffin) #2

You can try volume mounting the env.list & newenv.list from the host into the container and sourcing it.

Reference Link:
http://stackoverflow.com/questions/27583057/workaround-to-docker-run-env-file-supplied-file-not-being-evaluated-as-expec


(Nitinayyagari) #3

Yes, but i was just wondering how can i point to two env-files, say /var/app/old/file.conf and /var/market/old/db.conf , both in the command line as I find there is support for mutiple -e flags. Does Docker supports pointing to multiple env-file in a command line

docker run -d --hostname=158.64.72.80 -d -p 80:80 --env-file /var/app/old/file.conf --env-file /var/market/old/db.conf