Docker-Based ROS2 Development
A battle-tested playbook for containerizing ROS2 workspaces and running robot software stacks with Docker Compose.
Dev & CodingAdvanced★ 336⑂ 46AI score 9/10Last updated: Aug 12, 2026
What it does
A reference Claude consults whenever your ROS2 project meets Docker, with concrete, copy-pasteable code:
- Comparison table of the official OSRF image hierarchy (
ros-core→ros-base→perception→desktop) by size and use case - A four-stage multi-stage Dockerfile template (deps → dev → build → runtime) with rosdep layer caching and ccache
- docker-compose patterns: one container per subsystem, healthcheck-driven
depends_on, dev vs deploy profiles - CycloneDDS / FastDDS unicast XML configs for when DDS discovery breaks on bridge networks, plus
/dev/shmshared-memory zero-copy - Decision table for host vs bridge vs macvlan networking
- NVIDIA Container Toolkit setup and GPU passthrough via
deploy.resources - X11 / Wayland forwarding for rviz2 and rqt, plus headless Xvfb rendering for CI
- USB camera and serial passthrough, stable udev symlinks,
device_cgroup_rules - A full VS Code
devcontainer.jsonand a GitHub Actions matrix build with buildx layer caching - Common anti-patterns (monolithic containers, bridge networking with no DDS config) and their fixes
Who it's for
- Robotics engineers shipping ROS2 Humble/Jazzy/Rolling workspaces in containers
- Anyone stuck because nodes in separate containers can't discover each other's topics
- Teams that need GPU access for perception nodes or rviz2 running inside a container
- Teams moving ROS2 build and test into Docker-based CI
Example uses
- "Write a multi-stage Dockerfile for our colcon workspace, keep the runtime image minimal." → produces the deps/dev/build/runtime Dockerfile plus an entrypoint script.
- "After switching to a bridge network my containers stopped seeing each other's topics." → generates a CycloneDDS unicast peer XML and wires the volume/env vars into compose.
- "Give the camera node GPU access and /dev/video0, and only start rviz in the dev profile." → returns a docker-compose.yml with GPU reservations,
devices/group_add, and aprofiles: [dev]X11 service.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/arpitg1304/robotics-agent-skills/HEAD/skills/docker-ros2-development/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the skills/docker-ros2-development folder from the GitHub repo arpitg1304/robotics-agent-skills into my ~/.claude/skills/docker-ros2-development/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/arpitg1304/robotics-agent-skills.git && mkdir -p ~/.claude/skills && cp -r robotics-agent-skills/skills/docker-ros2-development ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal and confirm Claude Code is installed (
claude --version). - Clone the repository that contains the skill:
git clone https://github.com/arpitg1304/robotics-agent-skills.git - Create your personal skills directory if it doesn't exist:
mkdir -p ~/.claude/skills - Copy just this skill folder over:
cp -r robotics-agent-skills/skills/docker-ros2-development ~/.claude/skills/ - To scope it to a single repo instead, copy it into that project's
.claude/skills/directory. - Restart Claude Code and run
/skills(or ask "list my available skills") to confirmdocker-ros2-developmentappears. - Trigger it with a request like "write a Dockerfile for my ROS2 workspace" — it activates automatically.
- (Prerequisites) You'll need Docker and Docker Compose on the host, plus the NVIDIA Container Toolkit for any GPU examples.
View source on GitHub ↗License: Apache-2.0