
- Docker - Home
- Docker - Overview
- Docker - Installing on Linux
- Docker - Installation
- Docker - Hub
- Docker - Images
- Docker - Containers
- Docker - Registries
- Docker - Compose
- Docker - Working With Containers
- Docker - Architecture
- Docker - Layers
- Docker - Container & Hosts
- Docker - Configuration
- Docker - Containers & Shells
- Docker - Dockerfile
- Docker - Building Files
- Docker - Public Repositories
- Docker - Managing Ports
- Docker - Web Server
- Docker - Commands
- Docker - Container Linking
- Docker - Data Storage
- Docker - Volumes
- Docker - Networking
- Docker - Security
- Docker - Toolbox
- Docker - Cloud
- Docker - Build Cloud
- Docker - Logging
- Docker - Continuous Integration
- Docker - Kubernetes Architecture
- Docker - Working of Kubernetes
- Docker - Generative AI
- Docker - Hosting
- Docker - Best Practices
- Docker - Setting Node.js
- Docker - Setting MongoDB
- Docker - Setting NGINX
- Docker - Setting ASP.Net
- Docker - Setting MySQL
- Docker - Setting Go
- Docker - Setting Rust
- Docker - Setting Apache
- Docker - Setting MariaDB
- Docker - Setting Jupyter
- Docker - Setting Portainer
- Docker - Setting Rstudio
- Docker - Setting Plex
- Docker Setting - Flame
- Docker Setting - PostgreSql
- Docker Setting - Mosquitto
- Docker Setting - Grafana
- Docker Setting - Nextcloud
- Docker Setting - Pawns
- Docker Setting - Ubuntu
- Docker Setting - RabbitMQ
- Docker - Setting Python
- Docker - Setting Java
- Docker - Setting Redis
- Docker - Setting Alpine
- Docker - Setting BusyBox
- Docker Setting - Traefik
- Docker Setting - WordPress
- Docker Useful Resources
- Docker - Quick Guide
- Docker - Useful Resources
- Docker - Discussion
Docker - Setting Plex
Plex is a powerful media server that allows users to organize, stream, and access their media library from any device. It has an intuitive interface that lets any user organize movies, TV shows, music, and photos with ease, playing them seamlessly on any platform they want.
With Docker, you can package Plex and its dependencies into a container that will be guaranteed to perform consistently, regardless of the environment. This reduces compatibility issues and makes scaling, updating, or otherwise managing your Plex server much easier.
Prerequisites for Dockerizing Plex
Before we start with the steps for Dockerizing Plex, make sure you have the following prerequisites −
- Docker Installation − The basic requirement is to install Docker onto your system. You can download and install it from the official website: https://www.docker.com/get-started.
- Basic Knowledge of Docker − Basic concepts of Docker, such as Images, Containers, and Dockerfiles, will be helpful.
- Account on Plex Media Server − To set up and access your media server, you need to have an account with Plex. If you do not already have an account, you can create one on the Plex website.
- Prepare Media Files − Ensure your media files are well organized and ready once the Plex server is up and running.
- Enough Available Disk Space − Ensure enough disk space is available for Docker images and your media files.
Setting up a Plex Project
Let's understand step-by-step how to set up a Plex project −
Create a Project Directory
Lets run the commands: mkdir plex-docker && cd plex-docker. This will help us to create and navigate into the Plex project directory.

Initialize the Project
Now, lets create a basic structure by running touch Dockerfile docker-compose.yml to create the Dockerfile and Docker Compose file.

Directory Structure
Our project directory should now look like this −
plex-docker/ Dockerfile docker-compose.yml
Running Plex in Local
First, let’s navigate to the Plex Downloads page and download the installer for our operating system (Windows, macOS, or Linux).
Next, we can run the downloaded installer and follow the on-screen instructions to complete the installation. For Linux, we can use the package manager to install, e.g., for Debian/Ubuntu −
$ sudo dpkg -i plexmediaserver_<version>_amd64.deb
We should replace <version> with the actual version number of the downloaded package.
Once installed, the Plex Media Server should start automatically. If not, we can also start it manually. For Windows/macOS, we can find Plex in your Applications or Start Menu and launch it. For Linux, we can start the server using −
$ sudo systemctl start plexmediaserver
Next, we can ensure Plex is running by checking the system tray icon or verifying the service status on Linux −
$ sudo systemctl status plexmediaserver
To access the Plex Web App, we can open a web browser and go to http://localhost:32400/web to access the Plex Web UI. This URL will load the Plex setup interface where you can configure your media server.
Creating the Dockerfile
Create a file called Dockerfile in the project directory and include the contents below.
# Use the official Plex Media Server image from Plex FROM plexinc/pms-docker # Set environment variables if needed (e.g., for Plex claim token) # Uncomment and replace YOUR_PLEX_CLAIM_TOKEN with your actual token # ENV PLEX_CLAIM=YOUR_PLEX_CLAIM_TOKEN # Define the volume paths to persist Plex data and media VOLUME ["/config", "/transcode", "/data"] # Expose necessary ports for Plex functionality EXPOSE 32400/tcp 3005/tcp 8324/tcp 32469/tcp 1900/udp 32410/udp 32412/udp 32413/udp 32414/udp # Set the default command to run Plex Media Server CMD ["/usr/lib/plexmediaserver/Plex Media Server"]
Explanation
- FROM plexinc/pms-docker − Specifies the base image for Plex Media Server, ensuring you use the official and updated version.
- ENV PLEX_CLAIM=YOUR_PLEX_CLAIM_TOKEN − Optional; sets the Plex claim token for automated server claiming (commented out by default).
- VOLUME ["/config", "/transcode", "/data"] − Defines persistent volumes for Plex configuration, transcoding, and media files.
- EXPOSE 32400/tcp 3005/tcp 8324/tcp 32469/tcp 1900/udp 32410/udp 32412/udp 32413/udp 32414/udp − Exposes the necessary ports for Plex services and network communication.
- CMD ["/usr/lib/plexmediaserver/Plex Media Server"] − Specifies the default command to start the Plex Media Server within the container.
Building the Plex Image
Lets run the following command to build the Plex Docker image using the Dockerfile that we just created.
$ docker build -t plex-media-server .
-t plex-media-server − Tags the image with the name plex-media-server.
.: It specifies the build context, using the current directory.

To check if the image was created successfully, we can list all the Docker images.
$ docker images
We can find the plex-media-server in the list of images.

Running the Plex Docker Container
Now that we have our image ready, lets start a new container using the built image −
$ docker run -d --name plex -p 32400:32400 -v /path/to/config:/config -v /path/to/transcode:/transcode -v /path/to/media:/data plex-media-server
- -d − Runs the container in detached mode (background).
- --name plex − Names the container plex.
- -p 32400:32400 − Maps port 32400 of the container to port 32400 on the host for accessing Plex.
- -v /path/to/config:/config − Maps the host directory for Plex configuration.
- -v /path/to/transcode:/transcode − Maps the host directory for Plex transcoding.
- -v /path/to/media:/data − Maps the host directory where your media files are stored.
- plex-media-server − Specifies the image to use for the container.
Lets check if the container is running −
$ docker ps

To access the Plex Web UI, we can open a browser and go to http://localhost:32400/web.
Conclusion
In this chapter, we discussed the process of dockerizing the Plex Media Server, starting from setting up the project to running the Plex container locally. First, we have created the Dockerfile needed for defining the Plex image.
Next, step by step, we dealt with how to create a Docker image for Plex and run the Plex container with the needed configurations and volume mappings.
You can proceed with advanced configurations for Plex, integrate more Docker services, or scale up your current setup for extensive media management. You may also consider automating backups and updates.
FAQs on Dockerizing Plex Media Server
In this section, we have collected a set of Frequently Asked Questions on how to dockerize plex media server −
1. How do I access a Dockerized Plex Media Server?
To access the Plex Media Server running in Docker, fire up your favorite web browser and point it to the IP address of the Docker host on the appropriate port. You will likely need to configure port forwarding or network settings depending on your environment.
2. How do I add media libraries to a Dockerized Plex Media Server?
To add the media libraries in a Dockerized Plex Media Server, mount a volume containing your media files to the container. Configure Plex Media Server to search for media content on the mounted volume.
Further settings may be required in Plex Media Server to match the structure of your media library.
3. How do I configure Plex Media Server to access external storage in a Docker container?
To utilize external storage with Plex Media Server inside of a Docker container, you will have to mount the external storage as a volume in the container. You will then have to make sure Plex Media Server has the proper permissions to access the mounted volume.
You may need to configure Plex Media Server settings to point to where the storage is located.