Reputation: 12197
I have to setup the $ORACLE_SID every time I login into sqlplus on Oracle Docker image.
Steps to reproduce:
docker exec -it 19c bash
echo $ORACLE_SID
return me an empty line (very strange!?)export ORACLE_SID="ORCLCDB"
echo $ORACLE_SID
returns me ORCLCDB
which is the right name I setupexit
docker exec -it 19c bash
echo $ORACLE_SID
and it returns me an empty line againWhy the change is not permanent?
Upvotes: 3
Views: 4565
Reputation: 2442
Once the container is started, there's no
way to change/add the environment variable. Therefore, the best option is to stop and remove the existing container, then recreate it with the correct environment variable.
In Docker, you can set the environment variable on an image with an ENV
command in the Dockerfile. You can also configure the default environment used to start the container when you call docker run -e ...
Upvotes: 4