Jellyfin transcoding, Immich face detection and local AI models all run much faster on a GPU. With the NVIDIA Container Toolkit installed on the host, one flag hands the card to a container.
docker run --rm --gpus all ubuntu nvidia-smi
If that prints the familiar nvidia-smi table, the toolkit works and containers can see the GPU. The toolkit injects the driver libraries, so the image does not need its own driver. For a single card out of several, name it:
docker run -d --gpus '"device=0"' example/app:1.0
In Compose the same thing goes under deploy.resources.reservations.devices with driver: nvidia and capabilities: [gpu].
The flag alone does nothing without the toolkit. Docker then fails with an error that it could not select a device driver with capabilities gpu. I would install the toolkit from NVIDIA’s own repository and run nvidia-ctk runtime configure as their guide describes, then restart Docker. On Unraid the Nvidia Driver plugin takes care of this part. Intel and AMD GPUs do not use this flag; for those you pass /dev/dri with --device.
Further reading: Resource constraints: GPU, NVIDIA Container Toolkit install guide