Question: Is it possible to set docker container env from docker daemon configuration file?
When run a container, we can use -e
flag to set specific environment variables inside container, such as docker run -e foo=bar
.
But is it possible to configure docker daemon file such as /etc/default/docker
or /etc/sysconfig/docker
, then every docker container can has same env foo=bar
instead of use -e
flag.
[root@i-7guzl6d7 ~]# cat /etc/sysconfig/docker
# Docker Upstart and SysVinit configuration file
# Customize location of Docker binary (especially for development testing).
#DOCKER="/usr/local/bin/docker"
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
# Set container environment here?
# export FOO=BAR