I am trying to see if I am barking up the wrong tree. I have a Dell R730XD that has a Nvidia Tesla P1 that I would like to share with two containers I plan to run. One container will be for Plex, the other for Frigate. Is this possible for multiple containers to share hardware or am I wasting my time?
Containers will share a GPU.
On a laptop, you probably have two GPUs. I would share only one with your containers. First figure out what PCI address it has:
incus info --resources | grep "GPU:" -A 20
Then pass a GPU to the container like this:
incus config device add <container_name> gpu gpu gid=44 pci="0000:05:00.0"
Where 44
is the GID of video
group inside your container. You can check it like this:
incus exec <container_name> -- sudo --login --user ubuntu bash -c "getent group video"
When running Plex, you probably want a hardware acceleration. For that, inside the container add the default user to the video
and renderer
groups (default user for ubuntu containers is ubuntu):
incus exec <container_name> -- sudo --login --user ubuntu
sudo usermod -a -G render,video $LOGNAME
Now check the /dev/dri/ folder inside the container:
ls -al /dev/dri/
It should look something like this:
crw-rw---- 1 root video 226, 0 Nov 15 08:41 card0
crw-rw---- 1 root video 226, 128 Nov 15 08:41 renderD128
Finally, restart the container.