This repository provides a step-by-step guide to set up ROS 2 Iron Irwini with Gazebo Garden inside Docker on WSL2, with full NVIDIA GPU acceleration.
- Install Docker Desktop from https://www.docker.com/products/docker-desktop/.
- Enable WSL2 backend in Docker Desktop settings.
- Install Ubuntu 22.04 in WSL2:
wsl --install -d Ubuntu-22.04
- Open PowerShell and start WSL:
wsl
- Inside the WSL terminal, check that Docker is running:
Expected output:
docker --version
Docker version X.XX.XX, build XXXXXXX
- If Docker is not running, start Docker Desktop from Windows and retry.
Run the following inside WSL:
sudo apt update && sudo apt upgrade -y
bash scripts/install_nvidia_wsl.sh
cd docker
docker build -t ros2-iron-gazebo-gpu .
docker-compose up -d
docker attach ros2-gpu-container
Inside the container, run:
nvidia-smi
glxinfo -B
Expected output:
nvidia-smi
should detect the GPU.glxinfo -B
should showOpenGL renderer string: NVIDIA
.
Start Gazebo inside the container:
source /opt/ros/iron/setup.bash
gz sim -s /usr/share/gz/gz-sim7/worlds/empty.sdf -r -v 4 & gz sim -g &
- The Gazebo GUI should open, displaying an empty simulation world.
While Gazebo is open, run:
nvidia-smi
Expected output:
- The Gazebo process should be listed under GPU usage, confirming it's utilizing the NVIDIA GPU.
Check TROUBLESHOOTING.md for common issues.
MIT License - see LICENSE for details.