In my docker file am I modifying /etc/environment file to create system-wide environment variables.
When I run the image the value of these variables are empty (they are simply not set); However, if I ssh into the container they are set as expected.
I’m having a similar issue although I’m just trying to use existing environment variables. I don’t want to set environment variables.
I’m using CMD to run a shell script which uses ORACLE_HOME environment variable. When Docker runs the script ORACLE_HOME has no value. If I start the container with the bash shell (docker run -i -t … /bin/bash) the script works perfectly. ORACLE_HOME environment variable points to the Oracle installation.
I could use ENV in the dockerfile to point to the oracle installation but then that defeats the whole purpose of Oracle using Linux environment variables. If the oracle installation changes I would have to change the docker file when in reality I shouldn’t have to.
Basically it depends on how your format your CMD in your docker file, details can be found documented here. but sounds like you guys want to run your command in the “shell” format way