Plex is great. It’s versatile in that I can stream my media at home on my TV, on the go on my laptop and phone, or at my parents’ place. Currently, I have two copies of my media in case any thing ever blows up; however, I only have one instance of Plex configured, and it’s at my parents place. Every time I stream something on my TV at home, the TV fetches it via my inter-site VPN tunnel. Although I don’t currently have a data transfer limit on my Internet plan, this still seemed like a waste of bandwidth due to the fact that I have the exact same copy of data locally.
Given that I had recently containerized many of my internal applications and moved those applications from my parents’ place to my current home, running Plex on Docker seemed like a natural thing to do. And so this is exactly what I set out to do.
Before starting, I needed to add an additional hard drive to my container host. To give some context, the machine had three drives: one SSD for Ubuntu Server, one SSD for my Windows Server machine that I had virtualized, and one 1TB HDD for my current Docker applications. The application data did not have any form of data redundancy, so I decided to add an additional 1TB HDD to this machine and reconfigure the HDDs. I stopped my running services, moved all the data off of the HDDs to the SSD, and pretty much reformatted the hard drives. Checksumming is also a nice thing to have, so I encrypted my drives and created a two-disk btrfs raid1 filesystem. By scrubbing data on the drives regularly, it would reduce the probability of bit rot from occurring. With that out of the way, I moved the data to the newly configured btrfs volume and restarted my current Docker applications. I was ready to proceed with the rest of the setup.
Adding Plex wasn’t too bad: I used docker compose
once again to run the linuxserver/plex
image. Instead of exposing ports, I opted to use host networking instead. Additional container mount points were created, and I had to also mount the read-only network shares containing my media onto the host machine itself before mapping it to the container. I linked the Plex server to my account via a Plex claim code, and I was pretty much on my way. My Plex library at my parents just uses the new default Plex agent to search for metadata, which is adequate for my use cases, so I set up my libraries on this new server in exactly the same way.
[git:master] [email protected]:~/git/docker-config$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2f437ea82ce6 linuxserver/plex:1.31.0 "/init" 5 hours ago Up 5 hours docker-config-plex-1
ae593e4aa66e certbot/dns-cloudflare "sh -c 'trap exit TE…" 3 days ago Up 3 days 80/tcp, 443/tcp docker-config-certbot-1
4f7ea1ed985d docker-config-apache2-ext "dumb-init -v --rewr…" 3 days ago Up 3 days 80/tcp docker-config-apache2-ext-1
889e19f8eb10 docker-config-grafana "/run.sh" 3 days ago Up 3 days docker-config-grafana-1
ab44364dad23 docker-config-apache2-int "dumb-init -v --rewr…" 3 days ago Up 3 days 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp docker-config-apache2-int-1
b8e7c843ae5c mysql:8.0.31 "docker-entrypoint.s…" 3 days ago Up 3 days 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp docker-config-mysql-1
2b3f3dac3320 cloudflare/cloudflared "cloudflared --no-au…" 3 days ago Up 3 days docker-config-cloudflared-1

The next thing I needed to get working was hardware-accelerated decoding using the GPU, which was included with my lifetime Plex Pass. This hand-me-down machine has a 4GB NVIDIA Quadro K2200, so it should be sufficient for any video stream I throw at it. I had to install the NVIDIA Container Toolkit and the nvidia-smi
CLI utilities, and then map the GPU into the container. It took some time to figure out some weird quirks, but when I realized I had to reboot the actual host machine, everything just worked. nvidia-smi
was then able to confirm that streaming video to my TV decodes via the GPU:

nvidia-smi
In conclusion, running Plex on Docker is great and configuring hardware-accelerated decoding inside a container still works fine. Keeping Plex up-to-date is as straightforward as running docker compose pull
followed by docker compose up -d
. Transferring data from one host to another will be easy if and when I ever decide to upgrade my host machine because of containerization. Hurray!
Anyways, that’s all I have this time around. Until next time!
~Lui