Here is my Dockerfile:
FROM ros:kinetic-ros-core-xenial
CMD ["bash"]
If I run docker build -t ros . && docker run -it ros
, and then from within the container echo $PATH
, I'll get:
/opt/ros/kinetic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
If I exec
into the container (docker exec -it festive_austin bash
) and run echo $PATH
, I'll get:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Why are the environment variables different? How can I get a new bash process on the container with the same initial environment?
The ENTRYPOINT
command is only invoked on docker run
, not on docker exec
.
I assume that this /ros_entrypoint.sh
script is responsible for adding stuff to PATH
. If so, then you could do something like this for docker exec
:
docker exec -it <CONTAINER_ID> /ros_entrypoint.sh bash