Deploying Plex Home Media Streaming on Ubuntu 24.04
Step-by-step guide to deploy Plex Media Server with Docker Compose and Traefik on Ubuntu 24.04, with persistent storage and automatic HTTPS for streaming your media library.

Plex is a personal media server that organizes and streams your movies, TV shows, music, and photos to clients on every major platform, with metadata, transcoding, and remote access built in. This guide deploys Plex using Docker Compose with Traefik handling automatic HTTPS, claimed against your Plex account at first run, following home media streaming deployment practices documented in Vultr Docs.
Prerequisite: Get a Plex claim token from plex.tv/claim. It's valid for 4 minutes, so generate it just before starting the stack.
Set Up the Directory Structure
1. Create the project directory structure:
mkdir -p ~/plex-media-server/{config,transcode,media}
cd ~/plex-media-server
2. Create the environment file:
nano .env
TZ=YOUR_TIMEZONE
PLEX_CLAIM=YOUR_PLEX_CLAIM_TOKEN
DOMAIN=plex.example.com
LETSENCRYPT_EMAIL=admin@example.com
Deploy with Docker Compose
1. Create the Docker Compose manifest:
nano docker-compose.yaml
services:
traefik:
image: traefik:v3.6
container_name: traefik
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.letsencrypt.acme.email=${LETSENCRYPT_EMAIL}"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
restart: unless-stopped
plex:
image: plexinc/pms-docker:latest
container_name: plex
hostname: plex
expose:
- "32400"
volumes:
- "./config:/config"
- "./transcode:/transcode"
- "./media:/data"
environment:
- TZ=${TZ}
- PLEX_CLAIM=${PLEX_CLAIM}
- ADVERTISE_IP=https://${DOMAIN}:443/
labels:
- "traefik.enable=true"
- "traefik.http.routers.plex.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.plex.entrypoints=websecure"
- "traefik.http.routers.plex.tls.certresolver=letsencrypt"
- "traefik.http.services.plex.loadbalancer.server.port=32400"
restart: unless-stopped
volumes:
letsencrypt:
2. Start the services:
docker compose up -d
3. Verify the services are running:
docker compose ps
docker compose logs
Configure Plex Media Server
Open
https://plex.example.comin a browser.Sign in with the Plex account that generated the claim token.
Name the server and add libraries pointing to folders under
/data(your./mediamount).Let Plex scan and fetch metadata. Install client apps on your devices to start streaming.
Next Steps
Plex is running and streaming securely over HTTPS. From here you can:
Add Movies, TV, Music, and Photos libraries with custom agents and scanners
Enable hardware-accelerated transcoding with a Plex Pass subscription
Set up managed users and parental controls for shared access
For the full guide with additional tips, visit the original article on Vultr Docs.






