System environment in container

Hi all,

There is a linux container.
Its ENTRYPOINT is something like " source file-to-set-system-env.sh;start service"
But when I login to the container, using command "docker exec … ", I didn’t find any environment variables that should be set by file-to-set-system-env.sh.
And if I run the script manually, I can see them.
While, the next time I login to it, those environment variables are gone again.

Anybody knows why?

Thank you

Use the -e parameter to docker container run or environment in your compose file to set global variables. Why you lose them is because you define local variables and restart the shell with every new login.

1 Like

Thank you for you answer. it solved my question