Nvidia docker container runtime doesn't detect my gpu

Hello @SpidFightFR!

With hardware.nvidia-container-toolkit.enable = true;, the Container Device Interface (CDI) is used instead of the nvidia runtime wrappers.

With CDI you have to specify the devices with the --device argument instead of the --gpus one, like this:

$ docker run --rm --device nvidia.com/gpu=all ubuntu:latest nvidia-smi

Also, you will need to set Docker 25 (at least) in NixOS 24.05:

virtualisation.docker.package = pkgs.docker_25;

We are going to update the documentation to make this more clear and less error-prone. Please, let us know what would have helped in your case to identify the difference, it will help other users for sure.

6 Likes