admin管理员组

文章数量:1122832

I have a few docker services that use my graphics card as hardware acceleration (jellyfin, immich). When I comment-out the device mapping, the containers restart normally after reboot, but when I set the devices mappings, the containers won't restart after a (daemon) restart. The devices mappings look like this:

...
deploy:
      resources:
        reservations:
          devices:
            - driver: cdi
              device_ids:
                - nvidia/gpu=all
              capabilities: [gpu]
...

and this:

...
devices:
      - nvidia/gpu=all
...

Both do not restart. The services themself work perfectly once started manually and the device mappings also work as I have access to the graphics card.

I tried commenting out the devices and then everything worked (except the devices obv.). I was expecting that the containers restart normally as with the other containers. I assumed there was a problem with the deploy keyword as it is used for swarm mode, but even without the deploy keyword and using devices directly, the containers still don't restart automatically.

I also tried setting

...
deploy:
      restart_policy:
        condition: any
      resources:
        reservations:
          devices:
            - driver: cdi
              device_ids:
                - nvidia/gpu=all
              capabilities: [gpu]
...

but this also didn't work.

One solution that worked was using environment: nvidia and removing the other configurations. But this works only with a deprecated setting on my distribution (NixOS) and the current one recommends the one mentioned above.

本文标签: Docker Compose restartalways not working when using devicesStack Overflow