1
$\begingroup$

I follow the guide of kinetic - Installing from source and put the steps in a Dockerfile.

At this point, I get an error, although I follow exactly the guide, and although it works in the bash of the container created on the image before these lines, and although Catkin command not found shows the same - in bash, not in Docker, though.

RUN /bin/bash -c 'echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc &&\
    source ~/.bashrc &&\
    mkdir -p ~/catkin_ws/src &&\
    cd ~/catkin_ws/src &&\
    catkin_init_workspace &&\
    cd ~/catkin_ws &&\
    catkin_make'

Commenting catkin_init_workspace out, it throws catkin_make: command not found, and keeping it, it throws catkin_init_workspace: command not found of course.

$\endgroup$
0
$\begingroup$

In a Dockerfile, you cannot add the setup.bash to the .bashrc and then source the .bashrc. Instead, you want to source the setup.bash in one go:

RUN /bin/bash -c 'source /opt/ros/kinetic/setup.bash &&\
    mkdir -p ~/catkin_ws/src &&\
    cd ~/catkin_ws/src &&\
    #catkin_init_workspace &&\
    cd ~/catkin_ws &&\
    catkin_make'

And the line

catkin_init_workspace 

can be removed, the container also works without it.

Half of the credits go to catkin_make command not found executing by a dockerfile.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.