Credits to tatsuyai713 It gave me a good starting point.
These steps will guide you through setting up and using a ROS 2 Docker container on your x86-64 or arm64-based Ubuntu or Mac device, including desktop access through RDP or passthrough if using vscode dev-containers.
This sets up ROS2 Dev Container with Rviz2, Ignition Gazebo, Moveit2, Nav2, SLAM Toolbox and other dependencies.
-
Install Dev Container VSCode extension and Remote Development Extension pack
-
Clone the repository.
-
VSCode should ask you to reopen the directory in dev container. Or you can invoke
Dev Containers: Reopen in Container
from command panel in VSCode. -
You will need to source ROS2 using by running
source /opt/ros/humble/setup.bash
for now. -
Any GUI application can then directly be run using the terminal.
Method2: Docker Container for ROS2 with GUI via RDP (Tested on x86-64 Ubuntu 22.04 and arm64 M2 Mac)
This Dockerfile is designed to create a Docker container for ROS 2 Humble and includes the following main packages preinstalled.
- ROS2 Humble
- KDE Plasma
- Gazebo Ignition
- Moveit2
- SLAM Toolbox
- Nav2
- Docker installed on your system
- User added to docker group
Follow the official Docker installation guide.
Run the build script to build the Docker image and install all dependencies. This should take around 10-20 minutes.
cd docker
./build_container.sh
Initiate the container with
cd docker
./start_container.sh
Save the current state of the Docker container using
cd docker
./stop_container.sh
For terminal access, run
cd docker
./attach_container.sh
To use the KDE Plasma Desktop via xrdp, connect using an RDP client to 127.0.0.1
or localhost
.
-
Windows App / Microsoft Remote Desktop: Available on Mac and Windows. Use the host system's username and password.
-
Remmina: Available on Ubuntu. Use the host system's username and password.