I had browsed through a lot of related posts but still didn’t resolve this issue. I am quite new to Docker so sorry if this is repeated. So for my project, I have a shell script named vault-until.sh, which getting secrets from Vault and exported those secrets. Like ‘export DB_Password_Auto=(Some Vault operations)’ What I want to achieve is to copy this file to the docker container and source this file in the Dockerfile. So that those secrets can be accessed as environment variables inside the container. The code I have right now inside Dockerfile is:
COPY vault-until.sh /build
RUN Chmod -x /build/vault-until.sh
RUN /bin/sh -c “source /build/vault-util.sh”
After I log in to the container through “docker -exec -it -u build container-name /bin/bash” the environment var is still empty. It shows only after I type the source command again in the cli. So I am wondering is this mechanism of access vault secret as env vat actually plausible? If so, what I need to modify in the Dockerfile to make this work? Thank you!