This guide explains how to run Vulkan applications in a Docker container with display forwarding. It includes instructions for both Windows (with VcXsrv) and Linux systems.
- Docker with GPU support enabled (If not, use the noGPU branch)
- For Windows: VcXsrv and install WSL (
wsl --install). - For Linux: No additional X11 server is needed as X11 forwarding is native to Linux.
- Configuration Options:
- Select One large window.
- Set Display to
0. - Choose Start no client.
- Uncheck
Native OpenGL(since Vulkan is used, not OpenGL). - Check
Disable access control.
Run the following command to build the Docker image:
docker build -t vulkan-docker-test .Use the following command to run the container, allowing it to display via VcXsrv:
xhost +local:docker && docker run --rm -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix --gpus all vulkan-docker-testNote: Ensure VcXsrv is running before executing the Docker container command.
Grant Docker access to your X11 display by running:
xhost +local:dockerUse the following command to build the Docker image:
docker build -t vulkan-docker-test .Use the following command to run the container, allowing it to display via VcXsrv:
docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --gpus all vulkan-docker-test- On Linux, if there are display issues, ensure that xhost +local:docker has been executed to allow display access.
- On Windows, verify VcXsrv is running and that the settings are correct.
- Ensure Docker has GPU support enabled.
