This guide explains how to run MATRiX in a GPU-enabled Docker container on Linux with X11 display forwarding.
The provided Docker run script:
- starts a container with NVIDIA GPU passthrough;
- forwards the host X11 display for GUI applications;
- mounts the current repository into the container at
/workspace; - uses host networking for ROS, MuJoCo, and launcher communication;
- passes through common input, USB, DRI, Vulkan, and GLVND devices/libraries.
The launch script is:
scripts/docker/docker_run_gpu.shThere are two Docker-related scripts with different responsibilities:
scripts/docker/docker_run_gpu.shruns on the host machine. It starts the Docker container, mounts the repository to/workspace, enables GPU/X11/device passthrough, and forwards the command to run inside the container.scripts/docker/entrypoint.shruns inside the Docker image as the container entrypoint. It sources ROS and workspace setup files, prepares runtime environment variables/directories, then executes the command provided bydocker_run_gpu.sh.
The normal launch flow is:
host: scripts/docker/docker_run_gpu.sh
-> docker run zsibot/matrix:latest ...
-> container: scripts/docker/entrypoint.sh
-> ./bin/sim_launcher
Users normally run only scripts/docker/docker_run_gpu.sh; entrypoint.sh is wired into the Docker image.
Install these on the host machine first:
- Docker: https://docs.docker.com/engine/install/
- NVIDIA Container Toolkit: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html
- A Linux desktop session with X11 display forwarding available.
- A MATRiX Docker image. The default image name is
zsibot/matrix:latest.
If your image has a different name, set MATRIX_DOCKER_IMAGE when running the script.
Run from the repository root:
bash scripts/docker/docker_run_gpu.shBy default this runs:
./bin/sim_launcherTo use a different image:
MATRIX_DOCKER_IMAGE=matrix-dev:latest bash scripts/docker/docker_run_gpu.shTo run a custom command inside the container:
bash scripts/docker/docker_run_gpu.sh bashThe default container name is matrix-sim. Override it if needed:
MATRIX_DOCKER_CONTAINER=matrix-test bash scripts/docker/docker_run_gpu.shIf the container is still running and you need another shell:
docker exec -it matrix-sim bash- Run the script from the repository root. It mounts
$(pwd)into/workspace. - The script removes an existing container with the same name before starting a new one.
- The script temporarily allows local root X11 access with
xhost +local:rootand restores it on exit. - If Docker requires sudo on your host, run the script with
sudo -EsoDISPLAYis preserved.