Skip to content

Instantly share code, notes, and snippets.

@kingand
Last active July 29, 2025 07:57
Show Gist options
  • Select an option

  • Save kingand/ff301bc5b740abb43cd69350d9578d9d to your computer and use it in GitHub Desktop.

Select an option

Save kingand/ff301bc5b740abb43cd69350d9578d9d to your computer and use it in GitHub Desktop.
GPU-Enabled Docker Container on Windows 11

GPU-Enabled Docker Container (Linux) on Windows 11 (WSL)

Assumptions

  1. Windows 11 running Windows Subsystem for Linux (WSL) version 2 with Debian 11
  2. NVidia Windows 11 driver installed
  3. No need to install NVidia Linux driver within WSL (source)

Prerequisites

  1. Open the Debian terminal (e.g., launch Debian from Windows menu)

  2. Perform distribution update/upgrade

    $ sudo apt update
    $ sudo apt upgrade
    $ sudo apt install pciutils gnupg software-properties-common
    $ sudo apt update
    

Install CUDA Toolkit

IMPORTANT: ONLY install the toolkit meta package, not the drivers! (source)

  1. Open the Debian terminal (e.g., launch Debian from Windows menu)

  2. Install NVidia CUDA Toolkit from https://developer.nvidia.com/cuda-downloads

    $ wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda-repo-debian11-<cuda-version>-local_<cuda-version-full>-<nvidia-driver-version>_amd64.deb
    $ sudo dpkg -i cuda-repo-debian11-<cuda-version>-local_<cuda-version-full>-<nvidia-driver-version>_amd64.deb
    $ sudo cp /var/cuda-repo-debian11-<cuda-version>-local/cuda-*-keyring.gpg /usr/share/keyrings/
    $ sudo add-apt-repository contrib
    $ sudo apt update
    $ sudo apt install cuda-toolkit-<cuda-version>
    
  3. Verify that CUDA toolkit is installed and NVidia GPU is avialable

    nvidia-smi
    

See also: https://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html#wsl

References

  1. https://docs.nvidia.com/cuda/wsl-user-guide/index.html#getting-started-with-cuda-on-wsl
  2. https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html
  3. https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/user-guide.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment