Disclaimer: My steps may or may not work for you. This is what currently works for me. Good luck. Get familiar with docker-compose if you’re not already. It can save a lot of time when deploying services. Also: keeping all of your container configurations in a file than manually setting it up is a pro. Unfortunately, I don’t believe Plex supports HW transcoding in containers, meaning that you’re on your own. Take what you can get from others and find your solution. Bottom line is that you can get it working.
I don’t know if the legacy Nvidia runtime is required anymore. Mine is set up but I am no longer using the runtime under any containers. You can set it up if you want. I’ll leave the link in the notes for directions.
My Setup:
Host Hardware: Dell Poweredge r720xd
Host Hypervisor: VMware ESXi 7.0.0 (Build 16324942) + vSphere Enterprise 7\vCenter Standard 7
GPU: PCI Passthrough → Quadro M2000
DVB: PCI Passthrough → WinTV QuadHD (Binding /dev/dvb to the container does the trick)
VM VMware: Ubuntu Server 20.04.3 LTS (GNU/Linux 5.13.14-xanmod1 x86_64)
Docker: version 20.10.8
Docker Compose: version 1.29.2, build 5becea4c
Docker image: plexinc/pms-docker:plexpass
My steps for getting Nvidia HW transcoding working.
-
Install nvidia-driver-XXX (In my case 470)
-
Verify lshw -C Display (Verify driver is nvidia for your gpu)
-
Verify nvidia-smi (Verify the command runs. No library mismatches etc)
(After removing and installing the proper version, a reboot may be required to fix library mismatch errors.) -
Verify you have the latest version of docker. (Follow Docker wiki)
Docker Install docs -
Verify you have the latest version of docker-compose. (Version on the repo is outdated?) Follow docker wiki to manually link the latest binary. (This is to support the latest version of compose files. Which has better gpu handling → “Docker Compose v1.28.0+ allows to define GPU reservations using the device structure defined in the Compose Specification.”) Docker Docs (GPU Handling)
-
You’re going to have to have to modify the Plex image. Modify the dockerfile and have it install libnvidia-encode-XXX-server or modify your current container and manually do it through terminal and build a new image based off of that container. Google this. (Make sure the libnvidia version matches the version of your host nvidia drivers)
-
Build Plex container with docker-compose.
Create docker-compose.yaml inside of a directory
Navigate to the directory and run “docker-compose up-d”
My configuration for example. Not to be copied but to be referred to.
version: “3.4”
services:
PlexMediaServer:
container_name: PlexMediaServer
environment:
- PLEX_UID=0
- PLEX_GID=0
- ALLOWED_NETWORKS=192.168.1.0/24
- PLEX_CLAIM=YOURCLAIM
- TZ=America/Los_Angeles
network_mode: host
image: your_modified_image
restart: always
volumes:
- /path/to/your/config:/config
- /your/media/volumes/etc/:/media
- /your/transcode/tmp/path/:/transcode
devices:
- “/dev/dvb:/dev/dvb”
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
Notes:
Libnvidia-encode.so.1 - Plex Debug Log- Cannot Load (The minimum required driver for nvenc is …)
https://forums.plex.tv/t/libnvidia-encode-so-1-missing-from-docker-image/734602
Workaround:
Compile plex image with libnvidia-encode-XXX-server (Make sure the version matches your host’s nvidia driver version. Else you’ll get mismatches.)
Legacy Nvidia Docker runtimes
https://docs.docker.com/config/containers/resource_constraints/#gpu
Running nvidia-smi gives mismatch errors
Fix: Just start over, use “apt remove” to remove all of the nvidia-drivers you have installed. If you install libnvidia-encode, remove it. Install the nvidia-driver version you want and then restart the host.
Other driver issues
Try: disabling nouveau. Google some directions for your build.
Compose syntax issues
Fix: Verify that you have the latest docker-compose installed. As I said: you may have to manually set it up. I don’t think the repo’s have the latest. Package from 2019 I think. (Else you jacked up the actual yaml syntax)
Other issues (Plex)
Use the Plex Debug Logs to troubleshoot your issue.
nvidia-smi not showing sessions on the container
Info: From my experience, I’ve noticed that nvidia-smi shows the transcode sessions on the host but doesn’t show the sessions on nvidia-smi on the container.