The docker file is expected to be on the same folder level as the src
folder in the workspace
FROM osrf/ros:humble-desktop
ENV ROS_DISTRO=humble
RUN apt-get update && apt-get install -y \
python3-pip \
ros-${ROS_DISTRO}-ros-gz \
ros-${ROS_DISTRO}-navigation2 \
ros-${ROS_DISTRO}-nav2-bringup \
ros-${ROS_DISTRO}-ros-testing
RUN python3 -m pip install vcstool
RUN rosdep update
WORKDIR /home/sim_ws
COPY src src
WORKDIR /home/sim_ws/src/navigation2_ignition_gazebo_example
RUN rosdep install -y -r -i --from-paths .
WORKDIR /home/sim_ws
RUN /ros_entrypoint.sh colcon build
ENV IGN_IP=127.0.0.1
ENV IGN_GAZEBO_RESOURCE_PATH="/home/sim_ws/install/sam_bot_nav2_gz/share/sam_bot_nav2_gz/models"
To run the docker with GUI
xhost +local:docker
docker run \
-it \
--privileged \
--net=host \
--device /dev/dri/ \
-e DISPLAY=$DISPLAY \
-v $HOME/.Xauthority:/root/.Xauthority:ro \
${image_name} \
/bin/bash