Skip to content

Instantly share code, notes, and snippets.

@agtbaskara
Created November 18, 2023 02:24
Show Gist options
  • Save agtbaskara/0d77ce3ebf0150a6342515b4d42e9961 to your computer and use it in GitHub Desktop.
Save agtbaskara/0d77ce3ebf0150a6342515b4d42e9961 to your computer and use it in GitHub Desktop.
Docker Cheatsheet

Using Docker

Before building the docker image go to the cloned whill-robot directory

cd ~/catkin_ws/src/whill-robot

Build Docker images

docker build -t ros-noetic-zed .

For building using Jetson devices

docker build -f Dockerfile.jetson -t ros-noetic-zed .

Run this once on host every boot to enable GUI (Or add it to Ubuntu Startup applications)

xhost + local:docker

Run this to open a new interactive session (bash)

docker run -it --runtime nvidia --net=host --ipc=host --gpus all \
    --privileged \
    --env NVIDIA_DRIVER_CAPABILITIES=all \
    --env DISPLAY \
    --env QT_X11_NO_MITSHM=1 \
    --env TTY_WHILL=/dev/robot_whill \
    --volume /tmp/.X11-unix:/tmp/.X11-unix:rw \
    --volume /dev:/dev \
    --volume /etc/timezone:/etc/timezone -v /etc/localtime:/etc/localtime \
    --volume ~/catkin_ws:/root/catkin_ws:rw \
    --volume ~/.ros:/root/.ros:rw \
    --name ros \
    ros-noetic-zed \
    bash

host ~/catkin_ws directory will be binded to container /root/catkin_ws directory and host ~/.ros directory will also binded to container /root/.ros directory

To open new terminal use byobu inside container or run new interactive session

docker exec -it ros bash

To stop container

docker stop ros

To start container

docker start ros

To delete container (might be needed when rebuilding images)

docker container rm ros
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment