Skip to content

Instantly share code, notes, and snippets.

@ibrahiminfinite
Created December 22, 2023 16:33
Show Gist options
  • Save ibrahiminfinite/5826339e3774aca0fa29a2cd4fa4f619 to your computer and use it in GitHub Desktop.
Save ibrahiminfinite/5826339e3774aca0fa29a2cd4fa4f619 to your computer and use it in GitHub Desktop.
Docker file and run commands

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment