0
$\begingroup$

Rosanswers logo

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.


Originally posted by Ariel on ROS Answers with karma: 65 on 2020-04-20

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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 (https://docs.docker.com/develop/develop-images/dockerfile_best-practices/)


Originally posted by marguedas with karma: 3606 on 2020-04-20

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Ariel on 2020-04-21:
I missed the -y. Thanks for the answer! Also good tip to RUN it with apt-get update!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.