Skip to content

Launches Docker container running sample Vulkan application

License

Notifications You must be signed in to change notification settings

MarcusHsieh/vulkan-docker-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Vulkan Docker Sample with Xserver Setup

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.

Table of Contents

Prerequisites

  • 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.

Instructions

For Windows

1. Launch Xserver (VcXsrv, xlaunch.exe)

  • 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.

2. Build and Run Vulkan Docker Sample

Build the Docker Image

Run the following command to build the Docker image:

docker build -t vulkan-docker-test .
Run the Docker Container (Launch Ubuntu WSL)

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-test

Note: Ensure VcXsrv is running before executing the Docker container command.


For Linux

1. Set Up X11 Display Permissions

Grant Docker access to your X11 display by running:

xhost +local:docker

2. Build and Run Vulkan Docker Sample

Build the Docker Image

Use the following command to build the Docker image:

docker build -t vulkan-docker-test .
Run the Docker Container

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

Troubleshooting

  • 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.

Results!

image

About

Launches Docker container running sample Vulkan application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published