I launched Docker ROS in the main window through
sudo docker run -it osrf/ros:noetic-desktop-full
and then tried to open secondary terminal:
sudo docker exec -it <container_id> bash
, but a lot of commmands, like e.g. rostopic and roscore , do not work in the second terminal that I opened through exec. It just shows command not found when I type them.
>Solution :
You need to source your ROS environment once you have your shell in the container:
. /opt/ros/noetic/setup.bash
Afterwards your ros commands should work.