Any idea how I can make my Docker use my NVIDIA GPU?

I’m setting up my GTX 1060 for my Jellyfin container. Currently using Podman on it, but I’m moving it to Docker (snap).

I tried both stable and edge installs.

$ sudo docker run -d --name jellyfin --net=host --volume /home/.jellyfin/docker/config:/config --volume /home/.jellyfin/docker/cache:/cache --mount type=bind,source=/media,destination=/media,ro=false --user 1001:1001 --device /dev/nvidia0:/dev/nvidia0 --device /dev/nvidiactl:/dev/nvidiactl --device /dev/nvidia-modeset:/dev/nvidia-modeset --device /dev/nvidia-uvm:/dev/nvidia-uvm --device /dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools --runtime=nvidia --gpus all jellyfin/jellyfin
docker: Error response from daemon: unknown or invalid runtime name: nvidia.

channels:
  latest/stable:    20.10.24 2023-05-25 (2893) 135MB -
  latest/candidate: 20.10.24 2023-09-29 (2904) 135MB -
  latest/beta:      20.10.24 2023-10-02 (2910) 135MB -
  latest/edge:      24.0.5   2023-10-07 (2915) 136MB -
  core18/stable:    20.10.17 2023-03-13 (2746) 146MB -
  core18/candidate: ↑                                
  core18/beta:      ↑                                
  core18/edge:      ↑                                
installed:          24.0.5              (2915) 136MB -

also tried removing --runtime=nvidia, and got this:

$ sudo docker run -d --name jellyfin --net=host --volume /home/.jellyfin/docker/config:/config --volume /home/.jellyfin/docker/cache:/cache --mount type=bind,source=/media,destination=/media,ro=false --user 1001:1001 --device /dev/nvidia0:/dev/nvidia0 --device /dev/nvidiactl:/dev/nvidiactl --device /dev/nvidia-modeset:/dev/nvidia-modeset --device /dev/nvidia-uvm:/dev/nvidia-uvm --device /dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools --gpus all jellyfin/jellyfin
a1931bf82e62bc391ca595b42227c314aeba9d04e713a7b87f0558d70733e208
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory: unknown.

Docker should have GUI, but its problem also is that it is so heavy weight like when you have something like Ubuntu 22.04 LTS or something that based(with defined packages(think of something like LSB standard)) then you don’t need full running operating system in the background, but if you move such docker image to another computer, it could bring required thing instead of full operating system but that is not currently that way.

If Nvidia is supported this way under docker, don’t know but probably not…