Docker - Tutorials - Docker - ROS Wiki
Docker - Tutorials - Docker - ROS Wiki
org/docker/Tutorials/Docker
Please ask about problems and questions regarding this tutorial on answers.ros.org
(http://answers.ros.org). Don't forget to include in your question the link to this page, the versions of your
OS & ROS, and also add appropriate tags.
For reasons you'll come to understand in a bit, a host installation of ROS is not required for most of these
tutorials unless otherwise specified. To quickly grasp how this is possible with Docker, it's recommended
you try it (https://www.docker.com/tryit/) out with the online tutorial.
Contents
1. Installing Docker
2. Using ROS images
1. Pulling ROS images
2. Running ROS containers
3. Stopping ROS containers
4. Video Demonstration
Installing Docker
Before starting this tutorial please complete installation as described in Docker's installation instructions
(https://docs.docker.com/installation/). Installation instructions are available for multiple operation systems
including Ubuntu, Mac OS x, Debian, Fedora and even Microsoft Windows. ¯\_(ツ)_/¯
Note that for recent Linux distros, the installation really just boils down to running a single wget command.
You may also want add your user to the docker group to avoid having to use sudo permissions when you
use the docker command, as also noted further into Docker's installation instructions.
1 of 3 10/4/23, 09:13
docker/Tutorials/Docker - ROS Wiki http://wiki.ros.org/docker/Tutorials/Docker
This will pull the latest tagged LTS image of ROS from Docker Hub (https://hub.docker.com/account
/signup/) onto your local host machine. Specifically, the image name "ros" is registered with Docker's
Official ROS Repo images (https://registry.hub.docker.com/_/ros/).
Take a look at the Official ROS Repo and you'll find additional tag names you can use to help specify what
exact version and/or meta package level you'd like to use. The tags are built from each other in the same
manner as the respective ROS metapackage (https://github.com/ros/metapackages) dependencies
interlink, i.e. if you were to pull:
You would then also then locally posses the "noetic-ros-core" and "noetic-ros-base" tagged images as well.
This will move you into an interactive session with the running container. From here, it's basically as if
you're in a new bash terminal separate from your host machine. Now run the roscore command and you will
see ros master startup.
In a new terminal on the host machine, find the name of your new container, last container started using:
$ docker ps -l
Using the name of the container as the ID, in writing this tutorial docker happened to assign the string
"nostalgic_morse", we can start additional bash session in the same container by running:
Once inside, we'll need to setup our environment. The best way to do this is to using the entrypoint script
included in the docker image:
source ros_entrypoint.sh
If you ran the docker pull ros command, you will have a ROS 2 installation (dashing, foxy, etc.) try:
If you pulled a ROS1 Docker container tag (noetic, kinetic, etc.) try:
roscore
2 of 3 10/4/23, 09:13
docker/Tutorials/Docker - ROS Wiki http://wiki.ros.org/docker/Tutorials/Docker
4. Video Demonstration
Below video makes you understand how Docker can be utilized for different ROS versions on different
Operating systems.
(https://www.openrobotics.org/)
3 of 3 10/4/23, 09:13