How to Run Plex Media Server in Docker Containers

Plex Media Server is a media organization service for any operating system. Like Netflix, it allows users to have their streaming service. Run Plex Media Server in Docker containers and browse all your favorite media, games, and applications. 

Plex Media Server provides an organization and media streaming service available on every OS including Docker containers. Also, users can connect their hard disks consisting of various media files and view them anytime. Furthermore, this program even organizes data with its simple and accessible interface.

In this write-up, you’ll learn how to run Plex Media Server in Docker containers to set up your personal media server. 

Plex Media Server Features

So, what makes Plex Media Server so great? Listed below are some of its prominent features: 

  • Availability of cloud sync option.
  • Parental controls.
  • Encrypted connections with multiple user accounts.
  • Allows flinging of video from one device to another.
  • offline access to your media files.

Types of Networking for Plex Media Server

Before starting with the installation, decide which type of networking connection you wish to use. There are three types of connections available:

  • Bridge: creates a new network within the host network and runs containers. This new network is connected to the main physical network using an internal router. 
  • Host: uses the IP address of the host running a docker container.
  • MacVLAN: creates a new virtual computer on the network, which acts as a container. 

For Plex Media Server, host and macvlan are the safest options as they are easy to configure. Furthermore, docker-compose provides necessary YAML template files, which can easily be modified for the network connection.


For this tutorial, you will need a system with sudo privileges. You will also require a Plex account. So, sign up here before anything else. 

Run Plex Media Server in Docker Container

Now that the benefits of Plex Media Server are clear, let’s get started with the setup. We will use Docker and Docker compose in a Linux-based environment. To be specific, we will be using the latest Ubuntu edition for this tutorial. 

1. Update the System

The first step is to update the system repository and install the required packages. For Plex Media Server, we need the Vim editor apart from the updated repository. First, open the terminal by pressing “Ctrl+Alt+T”. Then, input the commands given below to perform the update operation and install the Vim editor.

## For CentOS/RockyLinux 8, use the yum package manager:
sudo yum update
sudo yum install curl vim
## For Debian/Ubuntu, use the apt package manager:
sudo apt update && sudo apt upgrade
sudo apt install curl vim

You should then get a similar output as seen below:

Install Vim

For Fedora, use the dnf package manager:

sudo dnf update
sudo dnf -y install curl vim

For a more detailed guide on installing Vim, check out this guide.

2. Install Docker and Docker Compose

Since we are running Plex Media Server in Docker, we must have Docker installed on the system. Follow this guide to install docker and docker-compose on Linux systems. Once you’re done installing Docker and Docker Compose,  check the Docker service and enable it using the systemctl command.

For instance:

sudo systemctl start docker && sudo systemctl enable docker

The output should look like this:

Run Plex Media Server in Docker

Next, add the user account to the Docker group as shown below:

sudo usermod -aG docker $USER
newgrp docker

$USER is an environment variable and consists of the username of the system. Hence, do not replace it with the username of your system. 

3. Create a Persistent Hard Disk Volume for Plex

Plex Media Server requires a dedicated volume on the system. Therefore, it is essential to create a separate volume for this specific purpose.

For instance, type:

sudo mkdir /plex
sudo mkdir /plex/{database,transcode,media}
Run Plex Media Server in Docker

Alternatively, you can check for the drive you want to mount by using the df command. For instance: 

df -h

The -h flag prints the output in a human-readable format. Browse through the device you wish to mount. Select that drive and create a separate directory for Plex Media Server using the mkdir command. 

Next, fill the dedicated volume with the media of your choice. Or you can fill it in later after starting the service. 

4. Run Plex Media Server in Docker

Plex can run in Docker in two ways: using Docker Container and using Docker-compose. In this write-up, we will look at both options. 

Run Plex Media Server in Docker Container 

Follow the steps given below for the successful setup:

First, pull the Plex Media Server Docker package using the pull command. For example:

sudo docker pull linuxserver/plex

After that, configure the networking parameters in the Plex container docker. If you are using Macvlan networking, set the following parameters:

docker run \
  -d \
  --name plex \
  --network=physical \
  --ip=<IPAddress> \
  -e TZ="<timezone>" \
  -e PLEX_CLAIM="<claimToken>" \
  -h <HOSTNAME> \
  -v /plex/database:/config \
  -v /plex/transcode:/transcode \
  -v /plex/media:/data \

For Host Networking, type:

docker run \
  -d \
  --name plex \
  --network=host \
  -e TZ="<timezone>" \
  -e PLEX_CLAIM="<claimToken>" \
  -v /plex/database:/config \
  -v /plex/transcode:/transcode \
  -v /plex/media:/data \

Run Plex Media Server in Docker-Compose

Alternatively, you can also run Plex in Docker-Compose by doing the method below:

To start, create a docker-compose.yml file using the vim editor. For example: 

vim docker-compose.yml
Run Plex Media Server in Docker

In the same file, add the lines given below. Make sure to replace the arguments appropriately. 

version: '2'
    container_name: plex
    image: plexinc/pms-docker
    restart: unless-stopped
      - 32400:32400/tcp
      - 3005:3005/tcp
      - 8324:8324/tcp
      - 32469:32469/tcp
      - 1900:1900/udp
      - 32410:32410/udp
      - 32412:32412/udp
      - 32413:32413/udp
      - 32414:32414/udp
      - TZ=Africa/Nairobi
      - PLEX_CLAIM=claim-ey6ekAqeQjosd1P
      - /plex/database:/config
      - /plex/transcode:/transcode
      - /plex/media:/data

After that, press ‘:q‘ to save the file, and exit from the editor. 

Next, run the container with docker-compose using the command shown below:

docker-compose up -d
Run Plex Media Server in Docker

The option -d starts the Docker Compose daemon as a detached service. It means that even if you close the terminal, the Plex will continue to run. 

Once the container has started, check the status using the docker command.


docker ps

5. Start the Plex Media Server 

Once the docker container is running, start the Plex service using the command given below:

sudo docker start plex

Alternatively, you can use the stop command to stop the Plex Server completely. For example:

sudo docker stop plex

6. Access the Plex Media Server Web UI

Plex Media Server can be accessed via the URL http://IP_address:32400/web. You should then see a similar output as this:

Run Plex Media Server in Docker

The Plex Web UI will present a homepage where you can sign in. After logging in successfully, it will take you through simple steps to sign in to your account on Plex and add more media libraries. You can also watch Live TV by selecting the desired channels. 

Now that Plex is finally running on your PC, you can fill up your drive with any media files you want. 

And there you have it, the complete guide on running Plex Media Server in Docker Containers. In this article, we’ve walked you through the entire process of setting up Plex Media Server in Docker. We hope this article proved helpful to you. 

If this guide helped you, please share it.

Leave a Reply