ROS2 Installation Using Docker (Docker and Container)

Docker and Container

Docker is a platform that enables developers to create, deploy, and run applications inside lightweight containers.

Containers package an application and its dependencies together, ensuring consistency across different environments.

Unlike virtual machines, containers share the host system's kernel, making them more efficient and quicker to start up.

Setting-Up Docker and Container

Setting Up Docker and Container 1

Setting Up Docker and Container 2

Setting Up Docker and Container 3

Setting Up Docker and Container 4

Setting Up Docker and Container 5

Setting-Up Docker for ROS

Setting Up Docker for ROS 1

Setting Up Docker for ROS 2 https://github.com/osrf/docker_images?tab=readme-ov-file

Setting Up Docker for ROS 3 https://hub.docker.com/r/osrf/ros/tags

% docker pull osrf/ros:<tag_name>
% docker pull osrf/ros:humble-desktop
docker pull

List images in the Docker

% docker images

Run image in a container

% docker run -it osrf/ros:humble-desktop
$ apt-get update
$ lsb_release -a
Run image in a container

Check the container running

% docker ps

We can use 'docker exec' command to connect to a running container in another terminal

% docker exec -it <id> bash

Source ros2 environment and use it Source /opt/ros/humble/setup.bash

We can add the source command in root/.bashrc

Add the source command in root
$ docker run -it -v $PWD/source:destination <id>
Add the source command in root 2
$ docker run -it -v $PWD/source:destination --name <name> <id>

Thank You. End of ROS2 Installation Using Docker (Docker and Container).