ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

docker rosdep install not working from Dockerfile

asked 2020-04-20 15:55:16 -0500

Ariel gravatar image

I am trying to build a container with some custom packages to run gazebo to avoid installing a new version of ubuntu (I have 16.04 and need melodic which runs on 18.04). My Dockerfile is:

FROM ros:melodic
RUN apt-get update && \
    apt-get install -y ros-melodic-gazebo-ros-pkgs

WORKDIR /home/catkin_ws
ADD src/ /home/catkin_ws/src
RUN rosdep install --from-paths /home/catkin_ws/src/
RUN catkin_make

The issue is that rosdep install throws the following error:

Do you want to continue? [Y/n] Abort.
ERROR: the following rosdeps failed to install
  apt: command [apt-get install ros-melodic-moveit-planners-ompl] failed
executing command [apt-get install ros-melodic-moveit-planners-ompl]
The command '/bin/sh -c rosdep install --from-paths /home/catkin_ws/src/' returned a non-zero code: 1

However, if I comment the last two lines in the Dockerfile, run the container (with bash) and execute them, they work. What do I have to modify so they are execute while building the container?

Thanks for the help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-04-20 16:26:37 -0500

marguedas gravatar image

Steps in Dockerfile cannot require user input, so you need to run rosdep using the -y flag for rosdep to install the packages without asking for confirmation (similar to what you did for apt-get install above).

It is also recommended to run apt-get update in the same RUN statement as the one installing packages to make sure the package list is up to date and not relying on past docker cache (

edit flag offensive delete link more


I missed the -y. Thanks for the answer! Also good tip to RUN it with apt-get update!

Ariel gravatar image Ariel  ( 2020-04-21 02:28:21 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-04-20 15:55:16 -0500

Seen: 1,496 times

Last updated: Apr 20 '20