content/guides/ros2/run-ros2.md
In this section, you will run ROS 2 in an isolated Docker container using official ROS 2 images, verify that ROS 2 is working, and install additional ROS 2 packages for development and testing.
The fastest way to get started with ROS 2 is to use the official Docker image. To pull an image, start a container, and open an interactive bash shell:
Pull and run the official ROS 2 Docker image:
$ docker run -it ros:humble
This guide uses the Humble distribution. You can replace humble with another supported distribution such as rolling, jazzy, or iron.
[!NOTE]
This environment is temporary and does not maintain persistence. Any files you create or packages you install will be deleted once the container is stopped or removed.
Verify ROS 2 is working:
$ echo $ROS_DISTRO
You should see output similar to:
humble
The official ROS 2 images include core packages. To install additional packages, use the apt package manager:
Update the package manager:
$ sudo apt update
Install the desired package:
$ sudo apt install $PACKAGE_NAME
Replace $PACKAGE_NAME with any package you want to install.
Some commonly used packages include:
ros-humble-turtlesim - Visualization and simulation toolros-humble-rviz2 - 3D visualization toolros-humble-rqt - Qt-based ROS graphical toolsros-humble-demo-nodes-cpp - C++ demo nodesros-humble-demo-nodes-py - Python demo nodesros-humble-colcon-common-extensions - Build system extensionsIn this section, you pulled an official ROS 2 Docker image, launched an interactive session, and extended the container's capabilities by installing additional ROS 2 packages using apt.
In the next section, you will configure a persistent workspace to ensure your code and modifications are saved across sessions.