TL;DR Plex on Docker, for those with Plex Pass, can take advantage of hardware transcoding if your CPU offers it. And the Plex docker container from LinuxServer has the extra packages necessary for hardware-accelerated HDR to SDR tone mapping.
Update: As of Plex version 1.29.1.6240 using docker for hardware tone mapping is no longer required. I still prefer to have my services in portable docker containers so if that interests you read on.
I hesitated migrating Plex to Docker because I assumed that getting hardware transcoding to work would be a pain, or impossible. Turns out it’s one line in docker compose.
I have lots of 4K movies with HDR that were choking when being transcoded. It turns out that while my 1019+’s CPU has hardware for HDR tone mapping, Plex requires a few extra packages to be installed for it to work: ocl-icd-libopencl1 and beignet-opencl-icd (See https://support.plex.tv/articles/hdr-to-sdr-tone-mapping/)
I figured that a properly maintained Docker image would have these dependencies installed and I was correct. I could probably install these myself on my Synology directly but then it’s more stuff to fuss with and I know the “right” solution is Docker, so why not try?
I used this article as a baseline: https://support.plex.tv/articles/201370363-move-an-install-to-another-system
I'm also using information from Linuxserver's Plex image readme: https://hub.docker.com/r/linuxserver/plex
Plex Media Server directory from /volume1/PlexMediaServer/AppData/ to /volume1/docker/plex/Library/Application Support//configin the Docker container.When I first got my Synology I used the GUI Docker tools to set up my containers. I was new to Docker and appreciated the visual interface. Now that I’m more familiar with Docker I’ve moved all of my containers over to Docker Compose and prefer it. What I didn't realize is the that Synology GUI is still just as useful as it was without docker compose. Even if a container is managed via compose, it still shows up in the list, I can still open up the details on a container, view its logs, etc. Edits to the container's settings still need to be made in the compose file however.
I’m using the linuxserver plex docker image: https://hub.docker.com/r/linuxserver/plex#application-setup. Take some time and read through their documentation. For reference here’s my docker compose entry for plex. If you don't want to use docker compose, you'll still have to launch the container via the command line as there's no way (that I know of) to map devices in the GUI.
docker-compose.yml
version: '3.8'
services:
plex:
image: 'lscr.io/linuxserver/plex:latest'
container_name: plex
network_mode: host
environment:
- PUID=1234
- PGID=5678
- VERSION=latest
devices:
- '/dev/dri:/dev/dri'
volumes:
- '/volume1/docker/plex:/config'
- '/volume1/TV:/volume1/TV'
- '/volume1/Movies:/volume1/Movies'
- '/volume1/Music:/volume1/Music'
restart: unless-stopped
A couple of notes here:
cat /etc/passwd. User ID is the first number, Group ID is the second.devices entry is the critical component of getting hardware transcoding to work./volume1/ on the docker side? Because this way all my library paths are identical from the DSM Plex installation. Maybe I didn’t have to do this but it made the transition seamless. sudo docker-compose up -d in the same folder as your docker-compose.yml file via SSH or using the docker create command via SSH if you don't want to use compose.Follow the rest of the steps as indicated in Plex’s migration guide:
As stated in the notes section under the docker compose file, all you have to do is be logged in with your Plex account in Plex's general settings and restart the container. The Linuxserver image's scripts will take care of the rest.
Why do you need HDR tone mapping?
Technically you don’t, you can leave this option off. However the video quality might look weird, dim, or generally off unless the high dynamic range information is mapped to standard dynamic range.
Why do you need Transcoding at all? Just use direct play.
I use direct play while at home, but when I’m out of the house or have friends accessing my Plex box I can’t directly serve an HDR 4k file.
Why not host two libraries with 4k content for home and 1080p content for everywhere else?
If you want to manage that more power to you, but I didn’t.
How do you keep Plex up to date?
LinuxServer’s docker image has a property called VERSION that it checks when the container boots up. Depending on what you select, and if you have a valid Plex pass token in the container, it will download and install the latest version of Plex then continue the boot process. There are tools they list on their docker page to notify you of when a new version is available and when it’s time to restart your container. TL;DR, just reboot the container.
Why not use Plex’s own Docker image instead of LinuxServer’s?
I use LinuxServer’s images for lots of other services and have had good luck with them. They also update them to keep pace with the core software’s new versions. If anyone wants to chime in with experiences using Plex’s official Docker image I’m all ears.
You did X wrong.
Not a question but tell me about it and I'll fix it! I'm still fumbling through this stuff the best I can.