Skip to content
A recipe to manage your Media 🎥 📺 🎵


Plex is a client-server media player system and software suite comprising two main components (a media server and client applications)

Plex Screenshot


  1. Docker swarm cluster with persistent shared storage
  2. Traefik configured per design
  3. A DNS entry for the hostname you intend to use, pointed to your keepalived IP


Setup data locations

We'll need a directories to bind-mount into our container for Plex to store its library, so create /var/data/plex:

mkdir /var/data/plex

Prepare environment

Create plex.env, and populate with the following variables. Set PUID and GUID to the UID and GID of the user who owns your media files, on the local filesystem


Setup Docker Swarm

Create a docker swarm config file in docker-compose syntax (v3), something like this:


I share (with my sponsors) a private "premix" git repository, which includes necessary docker-compose and env files for all published recipes. This means that sponsors can launch any recipe with just a git pull and a docker stack deploy 👍

version: "3.0"

    image: linuxserver/plex
    env_file: plex.env
      - /var/data/config/plex:/config
      - /var/data/media:/media
        - traefik.port=32400
        - traefik_public
        - internal
      - 32469:32469
      - 32400:32400
      - 32401:32401
      - 3005:3005
      - 8324:8324
      - 1900:1900/udp
      - 32410:32410/udp
      - 32412:32412/udp
      - 32413:32413/udp
      - 32414:32414/udp

    external: true
    driver: overlay
        - subnet:


Setup unique static subnets for every stack you deploy. This avoids IP/gateway conflicts which can otherwise occur when you're creating/removing stacks a lot. See my list here.


Launch Plex stack

Launch the Plex stack by running docker stack deploy plex -c <path -to-docker-compose.yml>

Log into your new instance at https://YOUR-FQDN (You'll need to setup a login for remote access / discovery to work from certain clients)

Chef's Notes 📓

  1. Plex uses port 32400 for remote access, using your user/password to authenticate you. The inclusion of the traefik proxy in this recipe is simply to allow you to use the web client (as opposed to a client app) by connecting directly to your instance, as opposed to browsing your media via
  2. Got an NVIDIA GPU? See this blog post re how to use your GPU to transcode your media!

Tip your waiter (sponsor me) 👏

Did you receive excellent service? Want to make your waiter happy? (..and support development of current and future recipes!) Sponsor me on Github / Patreon, or see the support page for more (free or paid) ways to say thank you! 👏

Flirt with waiter (subscribe) 💌

Want to know now when this recipe gets updated, or when future recipes are added? Subscribe to the RSS feed, or leave your email address below, and we'll keep you updated. (*double-opt-in, no monkey business, no spam)

Notify me 🔔

Be the first to know when recipes are added / improved!

    We won't send you spam. Unsubscribe at any time. No monkey-business.

    Powered By ConvertKit

    Your comments? 💬

    Last update: June 8, 2020