Complete Dockerfile ros2-humble-desktop
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)