My current setup for running a docker container is on the lines of this:
main.env
file:# Main export PRIVATE_IP=\\`echo
I had this issue when using docker run
in a separate run script run.sh
file, since I wanted the credentials ADMIN_USER
and ADMIN_PASSWORD
to be accessible in the container, but not show up in the command.
Following the other answers and passing a separate environment file with --env
or --env-file
didn't work for my image (though it worked for the Bash image). What worked was creating a separate env file...
# env.list
ADMIN_USER='username'
ADMIN_PASSWORD='password'
...and sourcing it in the run script when launching the container:
# run.sh
source env.list
docker run -d \
-e ADMIN_USER=$INFLUXDB_ADMIN_USER \
-e ADMIN_PASSWORD=$INFLUXDB_ADMIN_PASSWORD \
image_repo/name:tag