virtualisation.docker.enableNvidia vs hardware.nvidia-container-toolkit.enable

Hi! My server has an nVidia GPU which I use in a few docker containers that benefit from it (frigate, plex.) I recently upgraded from 23.11 to 24.05, and now I’m seeing this message when building:

trace: warning: You have set virtualisation.docker.enableNvidia. This option is deprecated, please set hardware.nvidia-container-toolkit.enable instead.

If I simply change virtualisation.docker.enableNvidia = true; to hardware.nvidia-container-toolkit.enable = true; in my config, then my GPU-enabled containers fail to start, with this error:

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].

I haven’t been able to find any documentation on this change - is there something I’m missing? Is there anything else I’m supposed to do to make this work?

Thanks!

They worked for me when I use docker run with --device nvidia.com/gpu=all and not --gpus all.

1 Like

That did it. Thanks!

I want to run InvokeAI with the docker-compose configuration, but cannot figure out how translate --device nvidia.com/gpu=all into this. Unchanged yaml is like

services:
  invokeai-cuda:
    <<: *invokeai
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

However, I’m getting an error similar to jgus:
Error response from daemon: could not select device driver "nvidia" with capabilities: [[gpu]]

I’ve tried tweaking the settings in various ways, but now I’m getting a different error:

Additional property device is not allowed

Any ideas || suggestions?

I’ve been using this:

deploy:
  resources:
    reservations:
      devices:
        - driver: cdi
          device_ids:
            - nvidia.com/gpu=all

Container runs, but vulkan doesn’t work for me - not sure if cuda would work…

If you find out anything else, I’d be happy to hear about it… Trying to switch to NixOS as main OS and this is kinda stopping me :sweat_smile:

1 Like

Thank you! It works with my RTX card :smiley:

Hey, that’s great to hear! :slight_smile:

Could you please try running vkcube to see if Vulkan has access to the host GPU?

A word of warning to anyone running Portainer on their system.

For some reason running a container with this config causes your Portainer web UI to crash with following error:

panic: runtime error: index out of range [0] with length 0

Portainer will keep crashing until you stop the problematic container.
For now personally I’m gonna have to stick with virtualisation.docker.enableNvidia since hardware.nvidia-container-toolkit.enable looks to cause problems.