ROS 2 Jazzy on Windows 11 using Docker Desktop

Architecture: Windows 11 → Docker Desktop → ROS 2 Jazzy Container. GUI applications are displayed via VcXsrv.

Step 1 - Install Docker Desktop

Download Docker Desktop and enable WSL2 integration.

docker --version
docker run hello-world

Step 2 - Install VcXsrv

Download and install VcXsrv. Start XLaunch with: Multiple Windows, Display 0, Start No Client, Clipboard enabled, Native OpenGL enabled, Disable Access Control enabled.

Step 3 - Project Structure

C:\ROS2-Jazzy
├── Dockerfile
├── build.bat
└── run.bat
C:\ROS2Projects

Step 4 - Dockerfile

FROM osrf/ros:jazzy-desktop

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -y \
    python3-colcon-common-extensions \
    python3-vcstool \
    python3-rosdep \
    git nano vim build-essential \
    x11-apps \
    libxcb-cursor0 \
    libxcb-xinerama0 \
    libxkbcommon-x11-0

RUN rosdep update
RUN mkdir -p /root/ros2_ws/src
RUN echo "source /opt/ros/jazzy/setup.bash" >> /root/.bashrc
WORKDIR /root/ros2_ws
CMD ["/bin/bash"]

Step 5 - build.bat

@echo off

docker build -t ros2-jazzy:1.0 .
pause

Step 6 - Build Image

docker build -t ros2-jazzy:1.0 .
docker images

Step 7 - run.bat

@echo off

docker run -it ^
--name jazzy ^
-v C:\ROS2Projects:/root/ros2_ws/src ^
-e DISPLAY=host.docker.internal:0 ^
ros2-jazzy:1.0

pause

Step 8 - Container Management

docker start jazzy
docker attach jazzy
docker exec -it jazzy bash

Step 9 - Verify GUI

echo $DISPLAY
xeyes
xclock

DISPLAY should be host.docker.internal:0.

Step 10 - ROS Talker/Listener Demo

ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_py listener

Step 11 - RViz2 and rqt

rviz2
rqt
rqt_graph
rqt_plot

Troubleshooting

qt.qpa.xcb: could not connect to display

echo $DISPLAY

Verify VcXsrv is running and the container was started with -e DISPLAY=host.docker.internal:0.

Could not load Qt platform plugin xcb

apt update
apt install -y libxcb-cursor0 libxcb-xinerama0 libxkbcommon-x11-0

Useful Commands

CommandDescription
docker imagesList images
docker psRunning containers
docker exec -it jazzy bashOpen shell
docker stop jazzyStop container

Congratulations

You now have a Windows 11 + Docker Desktop + ROS 2 Jazzy + RViz2/rqt capable development environment.