◆Smart Home Ideas Journal

Universal Media Server Docker Setup: Step-by-Step Guide

By

Universal media servers have become increasingly popular, enabling us to stream audio, video, and image files from a single location to various devices. Setting up a universal media server using Docker offers a flexible, isolated, and easily manageable solution. Let's delve into a step-by-step guide on how to achieve this.

Before we commence, ensure you have Docker and Docker Compose installed on your system. This guide assumes you're using a Linux-based OS, such as Ubuntu.

Setting Up the Environment

Begin by creating a new directory for your media server and navigate into it:

a flat screen tv sitting on top of a white table next to a lamp and chair
a flat screen tv sitting on top of a white table next to a lamp and chair
Self-hosting the Official Bitwarden Server with Docker
Self-hosting the Official Bitwarden Server with Docker
How to Run MCP Servers with Docker
How to Run MCP Servers with Docker

> mkdir universal-media-server

> cd universal-media-server

Setting up Vaultwarden using Docker
Setting up Vaultwarden using Docker
How to Set Up Docker on a Cloud Server - NSF Technology
How to Set Up Docker on a Cloud Server - NSF Technology
How to run a Minecraft Java Edition Server using Docker
How to run a Minecraft Java Edition Server using Docker

Creating the Docker Network

Establish a dedicated Docker network for your media server to ensure proper communication between containers:

> docker network create media-server-network

Initializing the Docker Compose File

Initialize a new Docker Compose file, which will handle the configuration of your media server:

a screen shot of a web page with the text self - hosting gitlab using docker
a screen shot of a web page with the text self - hosting gitlab using docker
Setting up the Heimdall Dashboard using Docker
Setting up the Heimdall Dashboard using Docker
Running an InfluxDB Server using Docker
Running an InfluxDB Server using Docker
Install Docker on Windows 11: Step-by-Step Guide for a Fresh WSL 2 Setup
Install Docker on Windows 11: Step-by-Step Guide for a Fresh WSL 2 Setup
Docker Mental Model: Containers, Images, Volumes & Ports (One Visual)
Docker Mental Model: Containers, Images, Volumes & Ports (One Visual)
How To Build A 23TB Plex Server With Docker
How To Build A 23TB Plex Server With Docker

> echo 'version: "3.8"' > docker-compose.yml

Now, let's add the necessary services to this Docker Compose file.

Configuring Docker Services

We'll use Plex as our media server software and_PORTainer for managing Docker. Both require a specific configuration within our Docker Compose file.

two screens showing the different types of docker and kubernets in one image
two screens showing the different types of docker and kubernets in one image
Docker Ecosystem Explained: Containers, Images, Volumes & More
Docker Ecosystem Explained: Containers, Images, Volumes & More
Setting Up a Media Server with Docker
Setting Up a Media Server with Docker
My Docker Stack
My Docker Stack
Running UniFi using a Docker Container
Running UniFi using a Docker Container
Docker Explained Simply Containers, Images, Commands & Why Every Developer Needs It
Docker Explained Simply Containers, Images, Commands & Why Every Developer Needs It
Easy Home Lab Projects with Docker
Easy Home Lab Projects with Docker
Self-hosting Zigbee2MQTT using Docker
Self-hosting Zigbee2MQTT using Docker
How to Set Up Remote Access to Docker Daemon [Detailed Guide]
How to Set Up Remote Access to Docker Daemon [Detailed Guide]
Kasm Workspaces Install: 5 Steps to Run your Linux Desktop inside a Docker container
Kasm Workspaces Install: 5 Steps to Run your Linux Desktop inside a Docker container
Set Up Plex Media Server Docker
Set Up Plex Media Server Docker
an image of a computer screen showing the different types of docker cls and how to use them
an image of a computer screen showing the different types of docker cls and how to use them

Plex Media Server

Add the following Plex configuration to your Docker Compose file:

> cat >> docker-compose.yml << 'EOF'

services:

plex:

image: plexinc/pms-docker:latest

network_mode: host

volumes:

- ./config:/config

- ./transcode:/transcode

- ./media:/media

environment:

- PUID=1000

- PGID=1000

- TZ=America/New_York

restart: always

EOF

Portainer

Next, add a Portainer configuration to manage your Docker containers:

> cat >> docker-compose.yml << 'EOF'

portainer:

image: portainer/portainer

command: -H localhost -p 9000

network_mode: host

restart: always

EOF

Now, let's set up some convenient environment variables to ease the initial setup process.

Setting Up Environment Variables and Volumes

To manage access rights and simplify configuration, create a `.env` file and add the following variables:

PUID and PGID

Set correct user IDs (PUID) and group IDs (PGID) for smooth functionality:

> echo 'PUID=1000' >> .env

> echo 'PGID=1000' >> .env

Media Directories

Specify the local paths for your media library and the transcode directory:

> echo 'MEDIA_DIR=/path/to/your/media' >> .env

> echo 'TRANSCODE_DIR=/path/to/transcode' >> .env

Remember to replace `/path/to/your/media` and `/path/to/transcode` with your actual directory paths.

Finally, launch your new media server with the updated commands:

Initializing and Running the Media Server

Pull the required Docker images and start the containers:

> docker-compose pull

> docker-compose up -d

Head to in your web browser to access Portainer and manage your media server. Configure Plex using its web interface at , and enjoy streaming your media!

Dockerizing your universal media server provides enhanced flexibility and isolation. Regularly update your containers and monitor your server's performance for an optimal streaming experience.