Docker Community Forums

Share and learn in the Docker community.

Passing environment variables to a docker image to a file in tomcat

(Tanmaybatham0908) #1

Expected behavior

When passing Environment variables via docker -d -e var1=value1 -e var2=value2 -e var3=value3 image_tag_name
It should pass those variables to container and whichso ever file we are using them like in if we use /usr/local/tomcat/webapps/applicationname/context/class/

and run smoothly

Actual behavior

docker -d -e var1=value1 -e var2=value2 -e var3=value3 image_tag_name
if not setting value in file


while passing environment variables in they are not getting reflected.

But when i exec the container i am able to see environment variable set in container.
using docker exec -it container id sh
and then env to show environment variables.
entries in
database host = ${DB_HOST}
database username = ${DB_USER}
database password = ${DB_PASSWORD}

Variables passed are of database host name, userid and password .