Issues passing environment variables to container

OS Version = Ubuntu Server 18.04
Docker version = latest version

My dockerfile looks like this

FROM ubuntu:18.04


COPY /usr/local/bin

RUN chmod +x /usr/local/bin/

ENTRYPOINT [ “usr/local/bin/” ]

CMD ["/bin/bash"]

There is this line in a file called test_cfg.ini that resides in /home/test/ in the container


My looks like


set -e

sed -i ‘s/{NAME}/$Name/g’ /home/test/test_cfg.ini

My goal is that when I run docker I can specify the ENV variables and then using sed I can replace the default variables in the file test_cfg.ini with the variables specified in the docker run command

When I build this image (called dockerimg1) it works fine, no errors, and when i run ‘docker run -e Name=TEST -it dockerimg1’ it launches me into bash. But if I look at that file it doesnt have NAME=TEST.

If in the sed command I specify something other than the docker env variable it will make the changes to test_cfg.ini, but there seems to be issues with the [] script seeing the environment variables specified in docker run -e NAME=TEST …

I’m fairly new to docker in bash so is there anything I have misconfigured in my files or is there perhaps an easier way to accomplish what I’m trying to do? The goal is to be able to pass variables into my container and edit a config file inside the container at run time, not build time