Plex Media Server with Docker Compose
With our easy-to-install Plex Media Server software and your Plex apps, available on all your favorite phones, tablets, streaming devices, gaming consoles, and smart TVs, you can stream your video, music, and photo collections any time, anywhere, to any device. In the project's words: plexinc/pms-docker README on GitHub (bridge networking, PLEX_CLAIM, ADVERTISE_IP, volumes) checked 2026-09-29
Runs on: amd64, arm64, arm/v7 from each image's registry manifest, checked 2026-09-29; a CPU counts only if every image has a build for it. Image by image
Add Plex Media Server to the builder to use your own domain and combine it with other apps in one file.
What Plex Media Server needs
Only figures Plex Media Server's own documentation publishes, each linked to the page it is on. Where the project gives no number, this page does not invent one.
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | not stated | 4 GB |
| Plex's requirements page: "4GB of RAM is typically more than sufficient for typical installs", and Linux installs "can often happily run with even less". Source: Plex support: Plex Media Server Requirements (RAM, CPU) checked 2026-09-29 | ||
| CPU | The project publishes no figure | |
| No single figure: the requirements page says CPU needs "can vary dramatically" with transcoding and the number of viewers, and that the ARM chips in many NAS boxes cannot transcode at all. Source: Plex support: Plex Media Server Requirements (RAM, CPU) checked 2026-09-29 | ||
| Disk | The project publishes no figure | |
| No minimum. The Docker README says the /config database is "usually a few GB" but can reach "the 100s of GBs" for large libraries, and that transcoder temp files need "the 10s of GB". Your media is extra. Source: plexinc/pms-docker README on GitHub (bridge networking, PLEX_CLAIM, ADVERTISE_IP, volumes) checked 2026-09-29 | ||
Which hardware Plex Media Server has images for
Read from each image's manifest list in its registry (anonymous, read-only) when this page was built. An app counts for a CPU only if every one of its images lists it.
- x86-64 PC or NAS (
linux/amd64): every image has a build. - Raspberry Pi 4/5, 64-bit OS (
linux/arm64): every image has a build. - Raspberry Pi 3 or Zero 2 W, 32-bit OS (
linux/arm/v7): every image has a build.
| Service | Image | Platforms in the manifest | Digest | Registry | Checked |
|---|---|---|---|---|---|
plex | plexinc/pms-docker | arm64, amd64, arm/v7 | sha256:e0ab27395614a8e1a4fdf84c6bc60ac664915cfdde70c52d030c7728a1c48e14 | registry-1.docker.io | 2026-09-29 |
docker-compose.yml
This is exactly what the builder writes for Plex Media Server alone on example.org: the official definition with its published ports removed and Caddy added in front. The time zone is Etc/UTC here; the builder uses your browser's. Every ${VARIABLE} is defined in the .env below.
# docker-compose.yml built at dankhost.com for: Plex Media Server # Each app block is its official compose definition. Only the names were prefixed with # the app slug (services, containers, volumes, bind folders, .env variables) so any set of # apps can share one file; other differences are listed under "Changed:" in each block. # Only Caddy publishes ports. Secrets live in .env next to this file. services: # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ---- # Source: https://caddyserver.com/docs/running (checked 2026-09-23) # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23) # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly. caddy: image: "caddy:2" container_name: "caddy" restart: "unless-stopped" ports: - "80:80" - "443:443" - "443:443/udp" volumes: - "./caddy:/etc/caddy" - "caddy-data:/data" - "caddy-config:/config" networks: proxy: ipv4_address: "172.30.0.2" # ---- Plex Media Server (plex.example.org) ---- # Source: https://github.com/plexinc/pms-docker (checked 2026-09-29) # Source: https://github.com/plexinc/pms-docker/blob/master/docker-compose-bridge.yml.template (checked 2026-09-29) # Source: https://support.plex.tv/articles/200430283-network/ (checked 2026-09-29) # Changed: Removed every documented port. Caddy reaches plex:32400, "the primary port that Plex uses", on the proxy network. Left out: 8324/tcp (Roku control), 32469/tcp and 1900/udp (DLNA) and 32410-32414/udp (network discovery), so Plex apps and DLNA players on your LAN do not find the server by themselves; the apps find it through your Plex account. # ADVERTISE_IP, documented as http://<hostIPAddress>:32400/, is https://plex.example.org:443, the address clients reach through the proxy. Plex publishes it to plex.tv for discovery, like a "Custom server access URL", which Plex's Network settings page describes for a server behind a reverse proxy. # PLEX_CLAIM is ${PLEX_CLAIM}, left empty in .env for you to fill in; TZ is your time zone; hostname <hostname> is plex (the server name shown in the apps). The <path/to/...> placeholders become ./config, ./transcode and ./media next to the compose file, and the obsolete version: '2' line and container_name are dropped. plex: image: "plexinc/pms-docker" container_name: "plex" restart: "unless-stopped" environment: TZ: "Etc/UTC" PLEX_CLAIM: "${PLEX_CLAIM}" ADVERTISE_IP: "https://plex.example.org:443" hostname: "plex" volumes: - "./plex/config:/config" - "./plex/transcode:/transcode" - "./plex/media:/data" networks: proxy: {} networks: # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact. # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's # ipv4_address and in every trusted-proxy value to a free 172.x.0 range. proxy: ipam: config: - subnet: "172.30.0.0/24" ip_range: "172.30.0.128/25" gateway: "172.30.0.1" volumes: caddy-data: caddy-config:
Caddyfile save as caddy/Caddyfile
Caddy gets and renews the HTTPS certificate for plex.example.org by itself once the DNS record points at your server and ports 80 and 443 reach it.
# Caddyfile built at dankhost.com. Save it as ./caddy/Caddyfile next to docker-compose.yml.
# Caddy gets and renews a Let's Encrypt certificate for each name below by itself,
# once the DNS records point at this server and ports 80 and 443 reach it.
# Plex Media Server
plex.example.org {
reverse_proxy plex:32400
}
.env
Plex Media Server needs no secret here; the builder adds nothing you have to fill in by hand.
# .env for Plex Media Server, from dankhost.com/app/plex/. Nothing here is secret. # Keep this file private (chmod 600). # Plex Media Server # Plex claim token: left empty on purpose. Before the first start, sign in at plex.tv/claim, copy the token it shows and paste it after the = sign. The README: it is used only on the first run, to sign the server in to your account. PLEX_CLAIM=
Changes from the official file
Besides prefixing every service, container, volume, folder and variable with plex (so any set of apps can share one file), these are all the differences from what the project documents:
- Removed every documented port. Caddy reaches plex:32400, "the primary port that Plex uses", on the proxy network. Left out: 8324/tcp (Roku control), 32469/tcp and 1900/udp (DLNA) and 32410-32414/udp (network discovery), so Plex apps and DLNA players on your LAN do not find the server by themselves; the apps find it through your Plex account.
- ADVERTISE_IP, documented as http://<hostIPAddress>:32400/, is https://plex.example.org:443, the address clients reach through the proxy. Plex publishes it to plex.tv for discovery, like a "Custom server access URL", which Plex's Network settings page describes for a server behind a reverse proxy.
- PLEX_CLAIM is ${PLEX_CLAIM}, left empty in .env for you to fill in; TZ is your time zone; hostname <hostname> is plex (the server name shown in the apps). The <path/to/...> placeholders become ./config, ./transcode and ./media next to the compose file, and the obsolete version: '2' line and container_name are dropped.
Notes for Plex Media Server behind the proxy
- Before the first "docker compose up", put a claim token in .env as PLEX_CLAIM (get one at plex.tv/claim while signed in). The README: without it "server will not be automatically logged in"; once the server is signed in the variable is ignored.
- Then open https://plex.example.org/web and finish the setup. Put your films and series in ./plex/media: inside the container that folder is /data, where you point the libraries.
- Remote access goes through Caddy on port 443 at https://plex.example.org:443, the address in ADVERTISE_IP. Plex's own Remote Access page tests port 32400, which this file does not publish, so it may report the server as not reachable from outside; apps still connect through the advertised address.
- The README warns that the database needs a file system with working file locking: keep ./plex/config on a local disk, not on NFS or SMB, or the database can be corrupted.
- Hardware transcoding (a Plex Pass feature) needs the README's --device=/dev/dri:/dev/dri mapping, which this file does not add.
- The image has no tag, as in the README and its compose templates, so Docker pulls 'latest'; the README lists version tags besides 'latest' if you want to pin one.
How to run it
- At your DNS provider, add an A record named
plexon your domain pointing at the server's public IP address, and forward TCP 80, TCP 443 and UDP 443 to it. - Save the three files in one folder:
docker-compose.ymland.envside by side, the Caddyfile at./caddy/Caddyfile. Replaceexample.orgwith your domain in the Caddyfile, the compose file and the .env, or let the builder do it. - Nothing in
.envneeds filling in;chmod 600 .envall the same. - Start it:
docker compose up -d docker compose logs -f caddy # watch the certificate arrive
- Open the new address (
plex.plus your domain) in a browser and follow the notes above.
Back it up
Plex's support article says to back up the main Plex Media Server data directory, and that the Cache folder can be left out on Linux. In this image that directory is inside /config (Library/Application Support/Plex Media Server).
Below is the BACKUP.md the builder writes next to the compose file above: which of its folders and volumes hold data, what to copy with which container stopped, and a restore check. Pick more apps in the builder and it covers them all in one file.
# BACKUP.md built at dankhost.com for: Plex Media Server
What to copy from the docker-compose.yml built with this file, the database dump each project documents (rewritten for the service names in that file), what to copy with which container stopped, and how to check the result. Run every command in the folder that holds docker-compose.yml.
The folders are owned by the containers' users: put sudo in front of tar if it says "Permission denied". Named volumes live under /var/lib/docker/volumes, not next to the compose file, so they are copied through a throwaway ubuntu container (Docker's documented --volumes-from method). tar makes a full copy each run; for large folders an incremental tool (restic, borg, rsync) saves time and space.
Never run "docker compose down -v" on this file: it deletes the named volumes of every app in it.
## Before you start
BACKUP=/mnt/backup/selfhost # change this: a disk or machine other than this server's system disk
mkdir -p "$BACKUP"
## Every time: the three stack files
tar czf "$BACKUP/stack-files.tar.gz" docker-compose.yml .env caddy
.env holds the database passwords and secret keys the apps were set up with; keep this archive as private as the data.
## Caddy (the reverse proxy)
Caddy's docs: 'The data directory must not be treated as a cache.' It holds the TLS certificates and their private keys; without it Caddy has to ask Let's Encrypt for every certificate again.
- caddy-data (named volume, /data in caddy)
BACK UP: TLS certificates, private keys, OCSP staples.
- caddy-config (named volume, /config in caddy)
SKIP: the last active configuration, kept for 'caddy run --resume', which this setup does not use: it starts from the Caddyfile.
- ./caddy (/etc/caddy in caddy)
IN stack-files.tar.gz: the Caddyfile, copied with the stack files above.
Copy (Caddy keeps serving while you copy):
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu tar cvf /backup/caddy-data.tar /data
Restore check:
tar tf "$BACKUP/caddy-data.tar" > /dev/null && echo OK
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu bash -c "cd /data && tar xvf /backup/caddy-data.tar --strip 1"
Sources:
- Caddy docs: Conventions, Data directory: https://caddyserver.com/docs/conventions#data-directory (checked 2026-09-24)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-24)
## Plex Media Server
Plex's support article says to back up the main Plex Media Server data directory, and that the Cache folder can be left out on Linux. In this image that directory is inside /config (Library/Application Support/Plex Media Server).
What this compose mounts:
- ./plex/config (/config in plex)
BACK UP: the Plex Media Server data directory: the database (view states, metadata, settings) and the preferences that hold the server's sign-in to your account.
- ./plex/transcode (/transcode in plex)
SKIP: transcoder temporary files.
- ./plex/media (/data in plex)
YOUR FILES: your films, series, music and photos. Plex's backups never include them.
YOUR FILES folders hold your own media, not Plex Media Server data. If this server has the only copy, back them up like any other files; the steps below leave them out.
The article also warns: never put the backup inside the Plex data folder, because Plex may delete files it does not recognise there.
1. Stop plex. Our advice, not Plex's: the database files change while Plex runs, so stopping it gives a copy of one consistent moment.
docker compose stop plex
2. Copy while plex is stopped:
tar czf "$BACKUP/plex-config.tar.gz" ./plex/config
3. Start it again:
docker compose start plex
Restore check:
tar tzf "$BACKUP/plex-config.tar.gz" > /dev/null && echo OK
Put a copy back (with plex stopped):
tar xzf "$BACKUP/plex-config.tar.gz" # recreates ./plex/config; move the old folder aside first
Stop it, put ./plex/config back, start it.
Sources:
- Plex support: Backing Up Plex Media Server Data: https://support.plex.tv/articles/201539237-backing-up-plex-media-server-data/ (checked 2026-09-29)
- plexinc/pms-docker README on GitHub (bridge networking, PLEX_CLAIM, ADVERTISE_IP, volumes): https://github.com/plexinc/pms-docker (checked 2026-09-29)
Sources
Every page below was fetched on the date shown.
- plexinc/pms-docker README on GitHub (bridge networking, PLEX_CLAIM, ADVERTISE_IP, volumes) checked 2026-09-29 (what it does, hardware requirements, compose definition and proxy settings, backup plan)
- Plex support: Plex Media Server Requirements (RAM, CPU) checked 2026-09-29 (hardware requirements)
- plexinc/pms-docker: docker-compose-bridge.yml.template checked 2026-09-29 (compose definition and proxy settings)
- Plex support: Network settings (Custom server access URLs for a reverse proxy) checked 2026-09-29 (compose definition and proxy settings)
- Caddy docs: Keep Caddy running (Docker Compose section) checked 2026-09-23 (Caddy)
- Vaultwarden wiki: Caddy with HTTP challenge (uses the caddy:2 image) checked 2026-09-23 (Caddy)
- Plex support: Backing Up Plex Media Server Data checked 2026-09-29 (backup plan)
- Caddy docs: Conventions, Data directory checked 2026-09-24 (backup plan)
- Docker docs: Volumes, Back up, restore, or migrate data volumes checked 2026-09-24 (backup plan)