Getting Started

How to Set Up Plex in Docker — Step-by-Step Guide

Published September 1, 2026 · 10 min read

Running Plex Media Server in Docker gives you clean separation from your host operating system, easy updates, and the ability to run Plex alongside other containerized services like Sonarr, Radarr, and Tautulli. Docker also makes it simple to migrate your entire Plex installation to new hardware by moving a few folders. This guide covers everything from pulling the image to enabling hardware transcoding.

Prerequisites

Before starting, make sure you have:

Step 1 — Pull the Plex Docker Image

The official Plex image is maintained by Plex, Inc. and available on Docker Hub:

docker pull plexinc/pms-docker

Alternatively, the LinuxServer.io community image (lscr.io/linuxserver/plex) is widely used and offers consistent environment variable conventions across all their images. Either image works well. This guide uses the official image.

Step 2 — Create a Docker Compose File

Create a directory for your Plex configuration and a docker-compose.yml file:

mkdir -p /opt/plex
cd /opt/plex

Create docker-compose.yml with the following content:

version: "3.8"
services:
  plex:
    image: plexinc/pms-docker:latest
    container_name: plex
    restart: unless-stopped
    network_mode: host
    environment:
      - TZ=America/New_York
      - PLEX_CLAIM=claim-xxxxxxxxxxxxxxxxxxxx
    volumes:
      - /opt/plex/config:/config
      - /opt/plex/transcode:/transcode
      - /mnt/media/movies:/data/movies
      - /mnt/media/tv:/data/tv
      - /mnt/media/music:/data/music
      - /mnt/media/photos:/data/photos

Replace the timezone, claim token, and volume paths with your own values. The key volume mounts are:

Step 3 — Understand Network Mode

The compose file above uses network_mode: host, which gives the container direct access to the host's network interfaces. This is the recommended approach for Plex because it simplifies discovery (GDM), DLNA, and remote access. The container will listen on port 32400 directly on the host IP.

If you cannot use host networking (for example, on macOS Docker Desktop), you can use bridge networking with explicit port mappings instead:

    ports:
      - "32400:32400/tcp"
      - "1900:1900/udp"
      - "3005:3005/tcp"
      - "5353:5353/udp"
      - "8324:8324/tcp"
      - "32410:32410/udp"
      - "32412:32412/udp"
      - "32413:32413/udp"
      - "32414:32414/udp"
      - "32469:32469/tcp"

Bridge mode works but may require additional configuration for local discovery and remote access.

Step 4 — Start the Container

cd /opt/plex
docker-compose up -d

Check that the container is running:

docker ps

You should see the plex container listed with status "Up." Access the setup wizard by navigating to http://your-server-ip:32400/web in a browser. If you provided a valid claim token, the server will already be linked to your Plex account.

Step 5 — Enable Hardware Transcoding

Hardware transcoding requires a Plex Pass subscription and a compatible GPU or integrated graphics. For Intel Quick Sync (the most common on Linux servers), you need to pass the render device into the container.

Add the following to your compose file under the plex service:

    devices:
      - /dev/dri:/dev/dri

For NVIDIA GPUs, install the NVIDIA Container Toolkit on the host, then add:

    runtime: nvidia
    environment:
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=compute,video,utility

After restarting the container, go to Plex Settings, then Transcoder, and enable "Use hardware acceleration when available." Run a test transcode to confirm it is working — you should see significantly lower CPU usage compared to software transcoding.

Step 6 — Set Up Automatic Updates with Watchtower

Plex releases frequent updates with bug fixes and new features. Watchtower monitors your running containers and automatically pulls updated images. Add a Watchtower service to your compose file:

  watchtower:
    image: containrrr/watchtower
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_SCHEDULE=0 0 4 * * *

This configuration checks for updates daily at 4 AM and automatically removes old images after updating. If you prefer manual control, skip Watchtower and update manually with:

docker-compose pull
docker-compose up -d

Step 7 — Verify and Configure

With the container running, finish your setup through the Plex web interface:

  1. Add your media libraries by pointing them to the /data/movies, /data/tv, and other paths inside the container.
  2. Enable remote access under Settings if you want to stream outside your home network.
  3. Set your transcoder temporary directory to /transcode (which maps to your host SSD mount).
  4. Configure scheduled library scans or enable filesystem monitoring.

Backup and Migration

The beauty of Docker is that your entire Plex installation lives in the /opt/plex/config directory. To migrate to new hardware:

  1. Stop the container: docker-compose down
  2. Copy the /opt/plex directory to the new machine.
  3. Install Docker on the new machine.
  4. Run docker-compose up -d.

Your libraries, watch history, user accounts, and all settings transfer with the config volume. Update your media volume paths in the compose file if they differ on the new machine.

Common Issues

Container starts but web UI is unreachable: Check that port 32400 is not blocked by a firewall. If using bridge networking, verify your port mappings. Run docker logs plex to check for errors.

Claim token expired: If the server is not linked to your account, stop the container, get a fresh claim token from plex.tv/claim, update the environment variable, and restart.

Permission errors on media files: The Plex container runs as a specific user (UID/GID). Ensure your media directories are readable by that user. You can set PLEX_UID and PLEX_GID environment variables to match your host user's ID.

Docker is the cleanest way to run Plex on Linux. Once configured, it requires almost no maintenance, and updates are a single command away.

Phlix — The Photo Browser for Plex

If you use Plex for photos, Phlix gives you a chronological timeline, year scrubber, 4K AirPlay slideshows, and offline downloads. Free to browse, Pro from $6.99/yr.

Download Phlix Free

iOS 17+ · Works with any Plex Media Server