Manually update the config because docker desktop doesn’t use the config at /etc/docker instead it uses the one at /home/username/.docker which the steps at NVidia - Configuring Docker modify.
Run docker run --runtime=nvidia --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody to confirm functionality.
(these steps are to the best of my memory…)
Only Docker Desktop for Windows supports GPUs when the WSL2 backend is used, since WSL2 supports GPUs. Otherwise you have a virtual machine without GPUs. So Docker Desktop for Linux does not support it, but on Linux, you can install Docker CE which does.
By the way as far as I know, you don’t need the runtime option when you use the gpus option since Docker CE 19.03. The nvidia container runtime project is archived
Thanks for the feedback @rimelek . I’ve got it working re your advice that docker desktop on linux doesn’t work for GPU related workloads, and instead to use Docker CE (a.k.a Docker Engine). It’s a real shame because I kinda loved that UI. I’m now using VSCode and the Docker plugin to manage my containers. I had to add my user to the docker group, but it’s working and I’m happy.
To make a note of what I did to get this working, I’ll leave this for posterity:
Uninstalled Docker Desktop completely before installing Docker CE
sudo apt remove docker-desktop
sudo apt purge docker-desktop
sudo rm -rf ~/.docker #plus any other places there's docker config
Removed any leftover packages that weren’t used elsewhere, just in case
Manually removed Docker’s network settings by removing the relevant configurations, basically any daemon.json files that were hanging around my system.
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
…and finally got the sexy output:
Fri Oct 25 22:53:04 2024
------------------------------------------------------------------------------------------
| NVIDIA-SMI 550.107.02 Driver Version: 550.107.02 CUDA Version: 12.4 |
|-----------------------------------------------------------------------------------------
| Extra stuff went here
------------------------------------------------------------------------------------------
I’ll consider this a moderate success. I’m going to miss that UI xD. Thanks for the guidance @rimelek !