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

Complete Dockerfile ros2-humble-desktop

asked 2023-06-16 12:00:55 -0500

vico gravatar image

Hey, I am looking for a complete humble-desktop Dockerfile, which is based only on ubuntu "FROM ubuntu:jammy" and not something like "FROM ros:humble-ros-core-jammy". I don't want to use "docker pull..." because i want to make changes to the Dockerfile along the way.

For now, is started with Ubuntu and then just added the installation steps from the Humble-Website to the dockerfile. However, i have problems keeping the container running. It always automatically exits. This is probably caused by the entrypoint.

I can run the container only with " docker run -it ...".

I want to use the Humble-image to later on use docker compose to connect two containers, one running micro-ros and the other one humble. So far it is not possible with the image this dockerfile creates.

FROM ubuntu:jammy

# Set the locale
RUN apt-get update && apt-get install -y locales && \
    locale-gen en_US en_US.UTF-8 && \
    update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
    export LANG=en_US.UTF-8

# Set the timezone
ENV ROS_VERSION=2
ENV ROS_DISTRO=humble
ENV ROS_PYTHON_VERSION=3
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Setup the sources
RUN apt-get update && apt-get install -y software-properties-common curl && \
    add-apt-repository universe && \
    curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null

    # Install ROS 2 packages
    RUN apt-get update && apt-get upgrade -y && \
        apt-get install -y ros-humble-desktop 

# install bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
    build-essential \
    git \
    nano \
    iputils-ping \
    wget \
    python3-colcon-common-extensions \
    python3-colcon-mixin \
    python3-rosdep \
    python3-vcstool \
    && rm -rf /var/lib/apt/lists/*

# bootstrap rosdep
RUN rosdep init && \
  rosdep update --rosdistro humble

# Environment setup
RUN echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc
RUN echo '#!/usr/bin/env bash' > /ros_entrypoint.sh
RUN echo 'source /opt/ros/humble/setup.bash' >> /ros_entrypoint.sh
RUN echo 'exec "$@"' >> /ros_entrypoint.sh
RUN chmod +x /ros_entrypoint.sh

ENTRYPOINT ["/ros_entrypoint.sh"]
# Run bash
CMD ["bash"]

This website gives me a docker humble desktop image but only with "docker pull osrf/ros:humble-desktop" (https://docs.ros.org/en/humble/How-To-Guides/Run-2-nodes-in-single-or-separate-docker-containers.html)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-17 04:51:11 -0500

130s gravatar image

This website gives me a docker humble desktop image but only with "docker pull osrf/ros:humble-desktop"

The webpage refers to the official Docker images. The configuration is also opensourced. You can find many Dockerfile examples that build on top of smaller Docker images.

https://github.com/osrf/docker_images

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2023-06-16 12:00:55 -0500

Seen: 5,502 times

Last updated: Jun 17 '23