ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

catkin commands not found when run from script in Docker container

asked 2022-01-28 12:57:08 -0500

I have a Docker image for my ROS environment which has been working fine. I can run catkin_make and do everything else I need to do. I wanted to do a bit of automation so wrote a very simple bash script that just runs the catkin_make command. I tried running the script inside the container, and it worked. So far, so good. Next I wanted to make the script the entry point for the image so running the container will just run the script. When I do so, I get "catkin_make: not found". Why would the script work perfectly when run from terminal inside container, but not when run as entrypoint to container?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-02-02 17:29:39 -0500

ruffsl gravatar image

updated 2022-02-02 17:29:48 -0500

When running the command from an interactive terminal session in the container, you are effectively running the session after the default entrypoint script for the container's image has been executed, which transitively sources the ROS environment for you (I'm assuming you are using the official library images of ROS from the Docker Hub). By overriding the default entrypoint inherited by the base image, you replace the entrypoint with your own, and thus you will need to source the existing / script at the beginning of your own entrypoint, or source the equivalent ROS setup yourself.

See the source Dockerfiles of the official library images of ROS for reference:

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2022-01-28 12:57:08 -0500

Seen: 312 times

Last updated: Feb 02 '22