Sign inSign up

nelsenew/workshop3

By nelsenew

•Updated almost 5 years ago

Docker container for ROS Workshop 3

Image
0

179

nelsenew/workshop3 repository overview

⁠Workshop 3 Docker Images

This repository hosts the Docker image for MLDA Workshop 3.

⁠Features

The docker image (10 GB) contains the following features:

  • Ubuntu 20.04 with GDM.
  • ROS Noetic.
  • Pytorch with or without CUDA

In addition, GUI applications are supported by Docker GUI and nvidia-docker:

  • RViz: ROS Visualization tools.
  • Gazebo: ROS Simulation tools.

⁠User Guide

Before running the Docker container, make sure that docker is installed on your system.

To pull the Docker image:

docker pull nelsenew/workshop3:<cpu/cuda>

Choose cpu if your computer does not support GPU, otherwise choose cuda

⁠Working with the docker container.

To run the Docker container for this workshop, you have to run the docker on interactive mode -it and attached catkin_ws to the docker volume. To run GUI Applications inside the docker container, X11 port forwarding and if possible, GPU hardware acceleration with docker gpu support such as nvidia-docker are required.

⁠Windows
⁠CLI

Use the following command to run the container with only CLI application.

docker run -it ^
    --volume="<path/to/your_ws>:/catkin_ws" ^
    nelsenew/workshop3:<cpu/cuda> ^
⁠GUI

In Windows, port forwarding is not yet installed. The common one is to setup VcXsrv ⁠ on your system.

Once everything is setup, the following batch script should be sufficient to run the docker container with GUI applications. run_container.bat

docker run  -it  ^
            --volume="<path/to/your_ws>:/catkin_ws" ^
            -e DISPLAY=host.docker.internal:0.0 ^
            -e LIBGL_ALWAYS_INDIRECT=0  ^
            nelsenew/workshop3:<cpu/cuda>

Execute the script by double clicking the icon or run the following command

run_container.bat
⁠Ubuntu

The following command should setup docker on Ubuntu:

  1. Install Docker curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh

  2. Add your user to the docker group sudo usermod -aG docker $USER

  3. Enable GPU acceleration (only if your device has NVIDIA GPU)

distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey⁠ | sudo apt-key add -
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list⁠ | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update sudo apt-get install -y nvidia-docker2 sudo systemctl restart docker


##### CLI
Use the following command to run the container with only CLI application.
``` bash
docker run -it \
    --volume="<path/to/catkin_ws>:/catkin_ws" \
    nelsenew/workshop3:<cpu/cuda>
⁠GUI

In ubuntu, X11 port forwarding has been installed. The following bash script should be sufficient to run the docker container with GUI applications.

run_container.bash

XAUTH=/tmp/.docker.xauth

xauth_list=$(xauth nlist :0 | tail -n 1 | sed -e 's/^..../ffff/')
if [ ! -f $XAUTH ]; then
    if [ ! -z "$xauth_list" ]; then
        echo $xauth_list | xauth -f $XAUTH nmerge -
    else
        touch $XAUTH
    fi
    chmod a+r $XAUTH
fi

file $XAUTH
ls -FAlh $XAUTH

docker run -it \
    --env="DISPLAY=$DISPLAY" \
    --env="QT_X11_NO_MITSHM=1" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    --env="XAUTHORITY=$XAUTH" \
    --volume="$XAUTH:$XAUTH" \
    --volume="<path/to/your_catkin_ws>:/catkin_ws" \
    --net=host \
    --privileged \
    --runtime=nvidia \
    nelsenew/workshop3:<cpu/cuda> \
    bash

Make the script executable

chmod a+x run_container.bash

Execute the script

./run_container.bash

For more information on GPU acceleration with docker on Ubuntu, please check the following link from ROS Wiki⁠.

Tag summary

Content type

Image

Digest

Size

4.9 GB

Last updated

almost 5 years ago

docker pull nelsenew/workshop3:cuda