Getting my GPU to work in docker

I recently added a Nvidia PNY Quadro P2200 to my server, and reinstalled it with Debian 10.2.
I am running plex in a docker.

When I start transcodes after the upgrade, I still see the load being put on CPU, and I can see any (hw) next to the transcode info in dashboard.

Is there any way to test if it is actually using the GPU at all? I have connected a monitor to it, and it outputs image on it, so the GPU works at least.

Running Plex Version 1.18.5.2260

CPU: i7-7700K
RAM, 64GB - of which 40GB is used for transcoding
GPU: Nvidia PNY Quadro P2200

Do I need to give the docker access to the GPU?
I have plex pass, and have enabled use hardware transcoding in transcoder settings.

edit: added these to docker container setup, but nothing changed:
–device=/dev/dri/card0:/dev/dri/card0
–device=/dev/dri/renderD128:/dev/dri/renderD128 \

Depending on which docker image you are using, linuxserver explains it here:


You have to use an extra docker container for the Nvidia driver set.

Figured it out eventually (reddit to the rescue).

This is what I did, for future reference:

#ADDING NVIDIA TO DOCKER:

nano /etc/modprobe.d/blacklist-nouveau.conf

#Add these lines:

blacklist nouveau
options nouveau modeset=0

REBOOT

update-initramfs -u
apt-get install gcc
apt-get install binutils
apt-get install make
apt-get install linux-source

mkdir /opt/nvidia && cd /opt/nvidia

curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \

sudo apt-key add - distribution=$(. /etc/os-release;echo $ID$VERSION_ID)

curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \

sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update

sudo wget nvidia-drivers-url (in my case, http://us.download.nvidia.com/XFree86/Linux-x86_64/440.44/NVIDIA-Linux-x86_64-440.44.run)

chmod +x ./NVIDIA-Linux-x86_64-440.44.run

./NVIDIA-Linux-x86_64-440.44.run

#Verify that drivers were installed

nvidia-sim

sudo apt install nvidia-docker2 nvidia-container-runtime

sudo systemctl daemon-reload

sudo systemctl restart docker

#then create the docker with

sudo docker run -d
–runtime=nvidia
–name=SERVERNAME
–network=host
-p 32400:32400
-e TZ=Europe/Oslo
-e PLEX_CLAIM="$token"
-e NVIDIA_VISIBLE_DEVICES=all
-e NVIDIA_DRIVER_CAPABILITIES=compute,video,utility
–mount type=tmpfs,destination=/transcode,tmpfs-mode=777,tmpfs-size=20G
-v /mnt/plex/plexdata:/config
-v /media/movies:/media/movies
–device=/dev/dri/card0:/dev/dri/card0
–device=/dev/dri/renderD128:/dev/dri/renderD128
plexinc/pms-docker:plexpass

chown in container (not sure if neccessary for GPU, but doing it just in case)

sudo docker exec -d CONTAINERNAME chown -Rv plex:plex /transcode
sudo docker exec -d CONTAINERNAME chown -Rv plex:plex /dec/dri/card0
sudo docker exec -d CONTAINERNAME chown -Rv plex:plex /dec/dri/renderD128

2 Likes

Lol, setting up the docker container I linked was to difficult? :wink:
Glad for you it worked out nevertheless.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.