Run Plex Media Server in Docker behind Traefik v3, with HTTPS certificates from Let's Encrypt handled automatically.
- Plex is served at
https://plex.example.com, and the Plex apps connect through it. - HTTP is redirected to HTTPS.
- Every setting lives in a single
.envfile.
- Docker with the Compose plugin (
docker compose version). - A domain name (for example
plex.example.com) with a DNS record pointing to your server. - Ports 80 and 443 reachable from the internet, so Let's Encrypt can issue the certificate. Nothing else on the machine may already use them.
-
Clone the repository:
git clone https://github.com/pierre-emmanuelJ/plex-traefik.git cd plex-traefik -
Create your settings file and edit it:
cp .env.example .env
Variable What to put there DOMAINYour Plex hostname, e.g. plex.example.com.ACME_EMAILYour email, for the Let's Encrypt account. PLEX_CLAIMA token from https://plex.tv/claim. It expires after 4 minutes, so get it right before step 4. PLEX_SERVER_NAMEThe server name shown in the Plex apps. PUID/PGIDYour user and group IDs, from id -uandid -g.TZYour time zone, e.g. Europe/Paris.MEDIA_PATHThe folder holding your movies, shows and music. It appears as /datain Plex. -
Create the data folders, so they belong to you rather than to root:
mkdir -p config transcode data
-
Start the stack:
docker compose up -d
-
Open
https://plex.example.com/web, sign in, and add your libraries from/data.
The server is linked to your Plex account on its first start, thanks to the claim token.
You can remove PLEX_CLAIM from .env afterwards.
The Plex apps reach your server through https://plex.example.com:443
(the ADVERTISE_IP setting). In Settings > Remote Access, Plex may show remote access
in red because port 32400 is not open. You can ignore it: apps and
https://app.plex.tv still connect through Traefik.
git pull
docker compose pull
docker compose up -dPlex updates itself when its container restarts. Traefik follows the latest v3.7.x release.
Port 32400 is published so that devices on your network can connect directly.
DLNA players, casting from local devices and network discovery need more ports.
They are listed and commented out in docker-compose.yml: uncomment the ones you need.
- Certificate errors. Check
docker compose logs traefik. Common causes: the DNS record does not point to this machine yet, or port 443 is blocked. While testing, setACME_CA_SERVERto the staging URL in.envto avoid Let's Encrypt rate limits. Deleteletsencrypt/acme.jsonwhen you switch back. - Permission errors in Plex. Make sure
PUID/PGIDmatch the owner ofconfig,transcodeand your media folder. - Claim token expired. Get a new one, put it in
.env, then rundocker compose up -d --force-recreate plex.
Older versions of this repository used Traefik v2, a Traefik/ folder and values hard-coded in
docker-compose.yml. To upgrade:
- Create
.envfrom.env.example, using the values you had indocker-compose.yml. - Run
git pull. Yourconfig,dataandtranscodefolders are kept. - Run
docker compose up -d --remove-orphans. Traefik requests a new certificate, so you can delete the oldTraefik/folder.