I have a simple docker container that runs a script on startup which exports some variables.
So the final line in my Dockerfile is CMD ./startup.sh
And startup.sh has
#!/usr/bin/env bash
export testvar="test"
echo $testvar
node app.js
The output in terminal when running container shows "test" as I would expect.
However if I then run docker exec -it *containerid* bash
and run echo $testvar
inside the container it's empty.
Has the environment var not persisted? Or does the terminal from running docker exec bash not have permission to see it or something?