Hi,
In my Dockerfile, I have declared a script “start.sh” to be run at ENTRYPOINT.
start.sh looks like this -
#!/bin/bash
export PATH=$PATH:/opt/bin
echo “10.220.2.55 mynode” >> /etc/hosts
useradd -u $UID -m -s /bin/bash $USER
su $USER
/bin/bash
- To spin a container I use -
docker run -it --detach --name=containername -e USER=${USER} -e UID=id -u
-e GID=id -g
imagename bash - I do a docker start and then attach to the container ‘containername’. Now, when I echo $PATH, I see /opt/bin present in the PATH
- I create another session to the same container using docker -exec -u $USER containername bash. Now, when I am inside the container I do not see PATH containing the /opt/bin. I am sure start.sh is running because I can see 10.220.2.55 in /etc/hosts.
What am I missing here? Any help, will be greatly appreciated.
Thanks.