Skip to content
Run GUI / GPU-accelerated ROS applications inside of Docker containers
Dockerfile Shell Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

ROS Docker Images

This project provides docker images for ROS, along with optional NVIDIA acceleration support, with a friendly startup script and VSCode development support.

Example use cases:

  • Testing a ROS network in a containerized environment
  • Running ROS melodic on Ubuntu 19.04, or on any unsupported platform

Docker Hub:

Setting Up

  1. Install the shell utilities
cd /tmp
git clone

cd docker-ros
rm -r ~/.docker-ros
cp -r shell/ ~/.docker-ros
  1. Edit your .bashrc / .zshrc to include the following lines
export UID=${UID}
export GID=${GID}

source ~/.docker-ros/

# OPTIONAL: Isolate the default HOME for the docker container if you don't want to passthrough your own.
  1. Install nvidia-docker2 if you have a NVIDIA GPU: nvidia-docker repo


$ ros <version>

Where <version> is one of the following:

  • kinetic, melodic - Aliases to kinetic-desktop-full and melodic-desktop-full
  • kinetic-ros-core, kinetic-ros-base, kinetic-robot, kinetic-perception, kinetic-desktop, kinetic-desktop-full
  • melodic-ros-core, melodic-ros-base, melodic-robot, melodic-perception, melodic-desktop, melodic-desktop-full

For example:

$ ros melodic

By default, the ros script will automatically:

  • Detect NVIDIA acceleration, and use the nvidia-docker2 runtime (you must install it first!)
  • Setup X forwarding
  • Create a new container image, passing through your local user and $HOME
  • Passthrough your current directory to /work via docker bind mount
  • Make the container interactive (-it --rm)

You can specify your own image with --image image:

$ ros --image myname/myimage:version

You can launch a program directly from the ros script if you don't require a bash prompt:

$ ros melodic rviz

Using with Visual Studio Code (VSCode)

Install the Remote - Container extension and copy the .devcontainer folder into your VSCode workspace.

Open the command palette with CTRL + SHIFT + P and select Remote-Containers: Reopen Folder in Container. VSCode will build a new container and open the editor within the context of the container, providing C++ and Python intellisense with the ros installation.

By default, the VSCode containers do not forward X11 nor run on the NVIDIA docker runtime. If you require GUI applications and/or NVIDIA acceleration, launch with ros <version> in a terminal (as seen in the 'Running' section above).

You can’t perform that action at this time.