Skip to content

Instantly share code, notes, and snippets.

@imontesino
Last active May 26, 2025 15:45
Show Gist options
  • Save imontesino/33f40191833185a17d79b85651cbf321 to your computer and use it in GitHub Desktop.
Save imontesino/33f40191833185a17d79b85651cbf321 to your computer and use it in GitHub Desktop.
Run WSL Docker container with OpenGL passthrough for GUI apps in a Windows Host
REM This script runs a Docker container for the Cobot Unity Connector with necessary configurations to output to the host display.
REM Ensure that the Docker service is running before executing this script.
set DOCKER_COMMAND=export MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA;^
docker run ^
--network host ^
--gpus all ^
--env NVIDIA_VISIBLE_DEVICES=all ^
--env NVIDIA_DRIVER_CAPABILITIES=all ^
--device /dev/dxg ^
--device /dev/dri/card0 ^
--device /dev/dri/renderD128 ^
--env DISPLAY=$DISPLAY ^
--env WAYLAND_DISPLAY=$WAYLAND_DISPLAY ^
--env XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR ^
--env PULSE_SERVER=$PULSE_SERVER ^
--volume /tmp/.X11-unix:/tmp/.X11-unix ^
--volume /mnt/wslg:/mnt/wslg ^
--volume /usr/lib/wsl:/usr/lib/wsl ^
-e LD_LIBRARY_PATH=/usr/lib/wsl/lib ^
-e LIBVA_DRIVER_NAME=d3d12 -it ^
<your-container-name>
wsl.exe -d Ubuntu-22.04 -u root --exec bash -c "%DOCKER_COMMAND%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment