Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What for is this ros_entrypoint.sh script?

This is the default endpoint for all official library ROS docker images, and simple sources the setup script. This is why you can simply pass ros commands like roslaunch or rosrun in the docker run command.

https://github.com/osrf/docker_images/tree/master/ros/noetic/ubuntu/focal/ros-core

Note that this endpoint isn't executed at build time, so RUN directives in the Dockerfile that expect the ROS environment to be sourced, e.g. chaining colcon workspaces or running rosdep, will have to source the setup script for that RUN directive. Each RUN directive run's in its own env, asside from the global ENV and ARG the scope over later layers.

https://github.com/ros-planning/navigation2/blob/69977cd83d9040df3422d8a2e564715b6002f3fb/Dockerfile#L50

Note that if you use docker exec to open a new shell in a ros container, that the default entry-point from the original docker image/file will not sourced automatically like for docker run. So for that, you could source it manually after launch the shell, or add it to the .bashrc for the default user (normally root) in the docker image, if you've passed bash to docker exec.