In my project, I used entrypoint.sh as a entrypoint wrapper script to set some dynamic variables inside the docker container.
#!/bin/sh
# entrypoint.sh
# Setting dynamic variable with another script
. /build/vault-util.sh
exec "/bin/bash"
Then in Dockerfile, I have
COPY vault-util.sh entrypoint.sh /build
ENTRYPOINT ["/build/entrypoint.sh"]
I am able to see the desired variables after starting the container with docker run -it [id] /bin/bash. It is listed in the environments. However, if I try logging into the same container with docker exec -it [id] /bin/bash. The variables are not showing up there. I am wondering what causes different environments with these two commands and what is a potential fix? Thanks!