This guide will walk you through how to use or install ROS Noetic in Docker. You will learn how to install Docker, how to choose a ROS Noetic Docker image, and pull and run the container.
If you prefer to install ROS Noetic through its metapackages, such as ros-noetic-desktop-full, without Docker, please follow guide on how to install ROS Noetic on Ubuntu 20.04.
What is ROS and Docker? Why use them?
Robot Operating System (ROS) is a framework to program robots, such as navigation (using the ROS navigation stack), manipulation (using moveit), and perception tasks (using PCL — Point Cloud Library). ROS Noetic is the latest ROS 1 release and will also be the last ROS 1 release. Compared to the previous ROS release ROS Melodic, ROS Noetic mostly features Python 3 as Ubuntu 20.04 drops the support to Python 2.
Docker is a container tool that allows you to run ROS Noetic without being on Ubuntu 20.04, which is the first-class OS that ROS officially supports. Using ROS Noetic with Docker also allows you to quickly provision a ROS Noetic environment without affecting, for example, you ROS Noetic Ubuntu installation.
Because we will install Docker to use ROS Noetic, you will need a Unix-like OS such Ubuntu (Preferred) or maxOS or Windows.
If you use a Linux OS or maxOS, you will need root access in order to run docker commands.
Step 1 — Install Docker for ROS Noetic
To use ROS Noetic in Docker, we will first install Docker.
We will use Ubuntu 20.04 to install Docker for ROS Noetic in this tutorial. If you use other operating systems such as Debian or CentOS, or non-Linux such as Windows or Mac, you can refer to the official Docker installation guide to install Docker.
We previous covered how to install Docker on Ubuntu 20.04. For a detailed installation, please read the guide. Here we will quickly install it.
First, install the following dependencies:
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Then add the official Docker key to avoid non-authetic packages:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Next add the official Docker repo:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
Note that we used the stable repo for Ubuntu 18.04 (codenamed Bionic) above. This is because the official Docker has not yet support Ubuntu 20.04 yet. But this still works because the official Docker package bundled all its dependencies in a single package.
Finally we install the offciial Docker packages, which are
sudo apt install docker-ce docker-ce-cli containerd.io
To verify the Docker installation, run
sudo docker -v
You should see the Docker version and a unique number for the build.
Step 2 — Choose a ROS Noetic Docker image
Current ROS Noetic Docker images support both Ubuntu 20.04 (Focal) and Debian 10 (Buster) OS. The Ubuntu images are recommended because it’s the first-class citizen OS in the ROS world. As you will notice below, the Ubuntu images are also the default if you don’t specify the OS.
Like the metapackages in the ROS Ubuntu installation, ROS Noetic Docker images are also categorized into different set of packages.
The following subsection will guide you to choose a Docker image, Once you choose a Docker image below, you can run
sudo docker pull to download it.
If you are a beginner, you can pull the
docker pull osrf/ros:noetic-desktop-full
If you are more experienced, you can pull the
noetic-ros-base image, which is aliased to
docker pull ros:noetic
Available ROS Noetic Docker images
The list of ROS Noetic images are:
Ubuntu 20.04 (Focal, default):
- Core: noetic-ros-core, noetic-ros-core-focal
- Base (default): noetic, noetic-ros-base, noetic-ros-base-focal
- Robot: noetic-robot, noetic-robot-focal
- Perception: noetic-perception, noetic-perception-focal
Debian 10 (Buster):
- Core: noetic-ros-core-buster
- Base: noetic-ros-base-buster
- Robot: noetic-robot-buster
- Perception: noetic-perception-buster
To pull those images, use
docker pull ros: and add the image name without a space, for example of
docker pull ros:noetic
The Docker images above are under
ros on Docker Hub. Open Source Robotics Foundation (OSRF) has the desktop images:
Ubuntu 20.04 (Focal, default):
- Desktop: noetic-desktop, noetic-desktop-focal
- Desktop Full: noetic-desktop-full, noetic-desktop-full-focal
Debian 10 (Buster):
- Desktop: noetic-desktop-buster
- Desktop Full: noetic-desktop-full-buster
To pull any of the images above, use
docker pull osrf/ros with the image name.
Explaining All ROS Noetic Docker images
noetic-ros-core Docker image provides a set of barebone packages. Pulling this image allows you to publish and subscribe to ROS nodes, as well as call ROS services and launch ros launch files.
noetic-ros-base Docker image is aliased to
noetic and is based on the
noetic-ros-core image. This ROS Noetic Docker image adds some other essential packages: actionlib, dynamic reconfigure, nodelets and pluginlib.
noetic-robot Docker image is based on the
noetic-ros-base image and adds the
viz metapackages as well as most packages used in the official ROS tutorials. So if you are using rviz (including rqt) or learning ROS, this package is the minimum package you want to install. In deed, this package is designed for installation on a physical robot, the
robot metapackage contains packages from
noetic-perception Docker image has Point Cloud Library (PCL)
perception_pcl library and image related libraries including
noetic-desktop is similar to the
noetic-robot image but not based on it. This image includes the
viz packages, as well as most tutorial packages.
noetic-desktop-full is based on the
noetic-desktop and adds the simulation and perception packages, such as Gazebo and PCL.
You can find exactly what packages are included in ros’s metapackages GitHub repo. The link points to the
Which Docker image should I pull by default?
If you don’t need GUI related stuff, the default
noetic image should be the go-to image, which also explains why it’s the default ROS Noetic Docker image.
If you want to use the GUI or you are a beginner, you can pull the
Step 3 — Pull ROS Noetic Docker Image
Here we will pull the
noetic image, which is really the
noetic-ros-base-focal image. You will see output like this:
Then you can check the ROS Noetic Docker image downloaded in your local machine by running
sudo docker image ls
As you can see, we downloaded the
ros Docker image tagged
noetic. Being under REPOSOTORY is a little bit confusing, but it is actually the image name. But it also makes sense: the name is really a repository under different tags.
Step 4 — Run ROS Noetic container
Once we downloaded the ROS Noetic image, we can run it with the
docker run command. The
-it parameter is for interactive, so it won’t immediately quit.
sudo docker run -it ros:noetic
You will see the following output. By default, Docker uses the root user and a random hostname.
But before you try to run any ros command like
roscd, don’t forget to
To stop the container, press
d to quit bash.
What to do next?
Congratulations, you now successfully pull and ran a ROS Noetic container using Docker! The ros page on Docker Hub guides you to use Dockerfile for your customized ROS project, how to mount you local folders and how to access external USB devices outside of Docker such as RGBD camera. Good luck to your ROS journey!
4 Steps to Install ROS Noetic with Docker
Time Needed : 8 minutes
- Install Docker for ROS Noetic
The simplest way is actually through your OS package manager. For Ubuntu, especially 20.04, run
sudo apt install docker.io, which will give you the relavant up-to-date Docker. Or you can install through the convenient script. First run
curl -fsSL https://get.docker.com -o get-docker.sh. Then run
sudo sh get-docker.sh.
- Choose and pull a ROS Noetic Docker image
Choose the noetic (aks noetic-ros-base) Docker image if you don't need GUI functionality. Or you can install the desktop-full image for full ROS Noetic experience. For the noetic image, run
sudo docker pull ros:noetic.
- Run the ROS Noetic container
docker runto run it:
sudo docker run -it ros:noetic.
- An OS that Docker support: Linux, macOS or Windows