Skip to content

Unable to use GPU inside NVIDIA docker container #578

Description

@fyang93

Bug description

I tried to use the NVIDIA Docker container on NixOS 24.05. According to the official docs, I set hardware.nvidia-container-toolkit.enable = true; and also enabled wsl.useWindowsDriver = true;. After setting the environment variable NIX_LD_LIBRARY_PATH = "/usr/lib/wsl/lib", I was able to get GPU information using nvidia-smi, confirming that it matches the output on Windows. Next, I checked that the CDI file exists and is valid by running cat /var/run/cdi/nvidia-container-toolkit.json; however, I still cannot access to the nvidia driver inside the container properly, the error message is attached in Logs.
It seems like the NVIDIA container toolkit did not correctly locate the driver files.

To Reproduce

Steps to reproduce the behavior:

  • Set wsl.useWindowsDriver = true; and hardware.nvidia-container-toolkit.enable = true; in flake
  • Set NIX_LD_LIBRARY_PATH = "/usr/lib/wsl/lib" in shell

Logs

 docker run --rm -it --device=nvidia.com/gpu=all ubuntu:latest /bin/bash
root@ac812a4a8cd7:/# nvidia-smi
NVIDIA-SMI couldn't find libnvidia-ml.so library in your system. Please make sure that the NVIDIA Display Driver is properly installed and present in your system.
Please also try adding directory that contains libnvidia-ml.so to your system PATH.

WSL version

WSL Version: 2.3.24.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.59
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.4317

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions