Nvidia toolkit - needed for Frigate?

Hello all

I want to use docker compose (via dockge) to run Frigate but according to the Frigate documentation [Hardware Acceleration | Frigate] I need to install the Nvidia toolkit which seems to require apt and all sorts, which will wreck my TrueNAS Electric Eeel.

(1) Is anyone running Frigate on TrueNAS Scale using docker or docker compose (rather than using the official app) ?

(2) My docker mechanism is via the @Stux original method involving jlmkr … would that somehow allow me to install the Nvidia toolkit “outside” TrueNAS scale such that I could try it?

following!

Some great news: Nvidia container toolkit - #2 by dasunsrule32

Thanks. Tried to read me up on the post you linked to. Could you explain a bit more how you did it to work?
When I run the command I only got

admin@truenas01[~]$ nvidia-container-cli list | grep -vFf <(nvidia-container-cli list --libraries)
nvidia-container-cli: initialization error: nvml error: driver not loaded
nvidia-container-cli: initialization error: nvml error: driver not loaded

Im quit new to this and try to learn.
So do I need to make a separate container with the nvidia toolkit? and then link the frigate container to use it?

I note you are running as admin@TrueNAS which is a user account signified by the $ rather than a root account in my case which is signified by the # and I don’t know whether that will make a difference for you.

Here’s what I did and what I presumed:

(1) I tried a lot of things of my own and tested by trying Frigate using “pure” docker. It didn’t work so I raised the “Nvidia container toolkit” feature request, believing it to be necessary for running Frigate.

(2) @dasunsrule32 replied and said said

This is already installed on the TNCE host by default

which I now presume probably means the efforts I expended in (1) above were unnecessary. I then followed the instructions posted, by launching a terminal via an SSH session into TrueNAS and then trying:

root@truenas[~]# nvidia-container-cli list | grep -vFf <(nvidia-container-cli list --libraries)

which responded as per the post with

/dev/nvidiactl
/dev/nvidia-uvm
/dev/nvidia-uvm-tools
/dev/nvidia-modeset
/dev/nvidia0
/usr/bin/nvidia-smi
/usr/bin/nvidia-debugdump
/usr/bin/nvidia-persistenced
/usr/bin/nvidia-cuda-mps-control
/usr/bin/nvidia-cuda-mps-server
/lib/firmware/nvidia/550.127.05/gsp_ga10x.bin
/lib/firmware/nvidia/550.127.05/gsp_tu10x.bin
root@truenas[~]# 

so then I followed the next command which is

# nvidia-container-cli -V

which also correctly responded, with

cli-version: 1.17.5
lib-version: 1.17.5
build date: 2025-03-07T15:46+00:00
build revision: f23e5e55ea27b3680aef363436d4bcf7659e0bfc
build compiler: x86_64-linux-gnu-gcc-7 7.5.0
build platform: x86_64
build flags: -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -DNDEBUG -std=gnu11 -O2 -g -fdata-sections -ffunction-sections -fplan9-extensions -fstack-protector -fno-strict-aliasing -fvisibility=hidden -Wall -Wextra -Wcast-align -Wpointer-arith -Wmissing-prototypes -Wnonnull -Wwrite-strings -Wlogical-op -Wformat=2 -Wmissing-format-attribute -Winit-self -Wshadow -Wstrict-prototypes -Wunreachable-code -Wconversion -Wsign-conversion -Wno-unknown-warning-option -Wno-format-extra-args -Wno-gnu-alignof-expression -Wl,-zrelro -Wl,-znow -Wl,-zdefs -Wl,--gc-sections
root@truenas[~]# 

which showed that the container toolkit is properly installed and working. I confirmed things further, by doing a docker service restart

# systemctl restart docker

and then I tried

# nvidia-ctk runtime configure --runtime=docker

which resulted in

{
    "data-root": "/mnt/.ix-apps/docker",
    "default-address-pools": [
        {
            "base": "172.17.0.0/12",
            "size": 24
        }
    ],
    "default-runtime": "nvidia",
    "exec-opts": [
        "native.cgroupdriver=cgroupfs"
    ],
    "iptables": true,
    "runtimes": {
        "nvidia": {
            "args": [],
            "path": "nvidia-container-runtime"
        }
    },
    "storage-driver": "overlay2"
}#                        

and finally I did

cat /etc/docker/daemon.json

which showed me

{"data-root": "/mnt/.ix-apps/docker", "exec-opts": ["native.cgroupdriver=cgroupfs"], "iptables": true, "storage-driver": "overlay2", "default-address-pools": [{"base": "172.17.0.0/12", "size": 24}], "runtimes": {"nvidia": {"path": "/usr/bin/nvidia-container-runtime", "runtimeArgs": []}}, "default-runtime": "nvidia"}#         

which all looked similar to the above.

At that point I tried Frigate again via a docker compose and got the same errors, and caused myself trouble with the existing Frigate app, so I stopped experimenting for the time being (because I don’t want to cause myself even more work for now!).

Conclusion: the Nvidia container toolkit is indeed installed and working, but I am doing something else wrong (or there is a different problem I’m not yet aware of).

So do I need to make a separate container with the nvidia toolkit? and then link the frigate container to use it?

No. I wondered if that would be the case but several searches and a chat with AI made me certain that the docker system within TrueNAS now has the Nvidia container toolkit available to it, and hence any containers you create will somehow automatically get access to the toolkit.

Additionally:

root@truenas[~]# nvidia-container-cli list should then list all the nvidia tools and shared objects (libraries of some sort) which demonstrates that the container toolkit is present and working. In fact, typing nvidia and pressing “tab” will show lots of options, for example

Check to make sure you can run nvidia-smi inside the frigate container.

Sorry - edited to be as detailed as possible …

I know that, in my case at least, I can’t get a Frigate docker container to “mount” for long enough to open a bash terminal.

Using (here’s the pertinent section)

I just get an immediate error along the lines of

Container frigate2  Recreate                                                                     0.0s 
Error response from daemon: unknown or invalid runtime name: nvidia
validating /opt/stacks/frigate2/compose.yaml: services.frigate.deploy.resources.reservations.devices.0.capabilities.0 must be a string
[+] Running 0/0
 ⠋ Container frigate2  Recreate                                                                     0.0s 
Error response from daemon: unknown or invalid runtime name: nvidia

I’ve tried a variety of alternatives, including explicit statements of the path to the nvidia runtime, but to no avail.

did you add the nvidia runtime to the container?

for my jellyfin i had to add it to my compose file so it looks like this (only a snippet)

services:
  jellyfin:
    image: lscr.io/linuxserver/jellyfin:latest
    runtime: nvidia
    container_name: jellyfin

I did - the container says

environment:
      PLUS_API_KEY: 1234123412341234
    runtime: nvidia # I added this line

(This is where I tried the full path as well as the notation shown here)

could you check if your docker daemon has the nvidia runtime in it?
last entry in my /etc/docker/daemon.json is

"default-runtime": "nvidia"}{"nvidia": {"path": "/usr/bin/nvidia-container-runtime", "runtimeArgs": []}}, "default-runtime": "nvidia"}

I did # cat /etc/docker/daemon.json on mine, which says

{"data-root": "/mnt/.ix-apps/docker", "exec-opts": ["native.cgroupdriver=cgroupfs"], "iptables": true, "storage-driver": "overlay2", "default-address-pools": [{"base": "172.17.0.0/12", "size": 24}], "runtimes": {"nvidia": {"path": "/usr/bin/nvidia-container-runtime", "runtimeArgs": []}}, "default-runtime": "nvidia"}#

I can’t work out how to display json here but in “pretty print” style, it’s this:

which looks the same I think.

OK i believe your indentation in the compose file is wrong.

it should look like this

environment:
      PLUS_API_KEY: 1234123412341234
runtime: nvidia # I added this line

I made a mistake copying my config into the forum: my actual indentation in the docker compose yaml is correct I think, and it looks like this:

image

Sorry.

yeah no worries, that was my last idea :dizzy_face: