osrf / docker_images

A repository to hold definitions of docker images maintained by OSRF
Apache License 2.0
527 stars 168 forks source link

[Question]bash: ros2: command not found #693

Closed badguyisme closed 9 months ago

badguyisme commented 9 months ago

Hi, I pull and run the docker image osrf/ros:humble-desktop-full successfully. When I input ros2 command in the container, everything seems ok image

However, when I open another terminal and using docker exec command to reach the same container, bash cannot find command ros2. image

Why is this happening? Hope to be answered, thank you!

mikaelarguedas commented 9 months ago

Indeed, you need to source the ROS environment to have access to the ROS tools:

source /opt/ros/humble/setup.bash

The entrypoint is only executed when starting the container not when logging into it: https://docs.docker.com/engine/reference/builder/#entrypoint

badguyisme commented 9 months ago

It works. Thanks for your helping.