ros-gazebo-gpu-docker
ros-gazebo-gpu-docker copied to clipboard
Dockerized ROS + Gazebo with GPU support
ROS Kinetic Desktop Full + NVIDIA in Docker
TL;DR: On Linux, to drop into an X11 enabled container created from sunside/ros-gazebo-gpu:kinetic-nvidia, run
./run-nvidia.sh
You'll be user ros with password ros and sudo powers. The current directory will be mounted to /workspace in the container.
I am aware that ROS Kinetic is somewhat outdated. However, for some projects I did I had the constraint to work with Kinetic and Gazebo 7 rather than any newer version. Since I was using Ubuntu 20.04 at the time (and ROS Noetic wasn't even released), I created this repo to help me and possibly others out. It is, after all, just a digest of information that can also be found all around the web.
Sourced documentation
- Ubuntu install of ROS Kinetic
- Hardware Acceleration
- NVIDIA Container Toolkit
- Install Gazebo using Ubuntu Packages
- Gazebo Models are available on Git
- nvidia/cudagl Docker image
Problems to steer around
A core issues that arise when just following the official documentation(s) are these:
- The
nvidia-docker2runtime is now deprecated and has been replaced withnvidia-container-toolkit; as a result,--runtime="nvidia"is not a valid option anymore and--gpus "all"(or similar) must be used instead. - The visualization tools (such as Gazebo and RViz) require OpenGL to work, which isn't available in the offical ROS Docker images (see here and here).
- Gazebo 7.0 is provided with the official ROS Docker image, but is outdated (see here and here). The Docker image comes with Gazebo 7.x from Gazebosim's package sources.
- X11 authentication may fail due to a subtle bug when passing arguments along.
Build with GPU support
For NVIDIA GPU support, go to the docker/nvidia directory and follow the instructions there.
If in a hurry, just run
docker/nvidia/build.sh
This should provide you with the image sunside/ros-gazebo-gpu:kinetic-nvidia.
Start the container with
./run-nvidia.sh
and you're ready to go. Note that this will create a container named ros, so running the command twice won't work. You can,
however, docker exec -it ros bash into the running container as often as you like.