running nvidia-docker on Windows 10 + WSL2 running nvidia-docker on Windows 10 + WSL2 docker docker

running nvidia-docker on Windows 10 + WSL2


I think the best way to get nVidia GPU (CUDA) running on WSL2 is to follow the tutorial from nVidia documentation CUDA on WSL. There are three thing you need do them correctly and in order:

  1. First, check your windows if there is an updates, update if there is any. Then you need to subscribe in Microsoft Windows Insider Program, specifically subscribe in Dev Channel (Fast ring). Make sure that is set to Dev channel not Beta Channel nor Release Preview Channel. Here was the tricky part for me, after you select Dev channel check your windows version by running (winver) program (search for it in the search bar of windows) if it's below 20145 go re-check your windows for an update (you will see in the update discription version above 20145 is availble). You nedd to install it, here you need to be patient because it take while to download and install the update, it will ask you for windows restart. After the restart you're good to go (you will also notice some design diffrence between the two version of windows). Check again your windows version with (winver) to find it, it's indeed above 20145.
  2. Next, install the NVIDIA preview driver for WSL 2, it's pretty straight forward process.
  3. Finally, install WSL2 from tutorial, this is also pretty straight forward process. Personaly, i follewed this youtube tutorial from David Bombal channel.

After these three steps preformed correctly, you can follow along the nVidia tutorial from Setting up CUDA Toolkit.Here is another nVidia document stating the same issue you're facing in Chapter 8. They claim that This error usually indicates that the right Microsoft Windows Insider Preview Builds, WSL 2, NVIDIA drivers and NVIDIA Container Toolkit may not be installed correctly.

For me, it was my Windows Insider Preview Builds version not properly set to version 20145 or higher.


by https://docs.docker.com/docker-for-windows/wsl/

  • uncheck "Enable integration with my default WSL distro" and apply,

  • then uncheck "Use the WSL 2 based engine" and apply.

  • check all above and enable:"Enable integration with additional distros:"Ubuntu-20.04

  • open terminal:

    docker ps CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

it works on my win10 docker 3.6...