Docker Plex Server¶
This lab uses a Raspberry Pi to run a Plex server as a Docker Container that's connected to a remote file share for media files
Goal¶
Setup a Plex server as a Docker container hosted on a Raspberry Pi.
Mount the media share¶
Create a target mount point¶
On the Raspberry Pi, create a directory that will act as the mount point for the remote file share. In this example, we'll create a directory called /media-share
in the root of the file system:
Setup credentials to be used to access the NAS media share¶
Add the NAS media share username and password to a file named cifs-credentials
so it can be used when you mount the drive as it's more secure to store your SMB/CIFS username and password in a credentials file instead of directly in the /etc/fstab
file.
In the editor, enter your username and password like this:
Next, change the permissions of the credentials file to ensure that only root can read and write it:
Test the share is mounted¶
Now you can mount the share using the target mount point and the credentials file. Once mounted browse to the mount and check you can see the contents.
Configure the share to mount automatically¶
To ensure that the remote share is automatically mounted at startup, add an entry to your /etc/fstab
file and add the following line at the end of the file:
Run Plex as a Docker container¶
Create the docker-compose file¶
Create a new directory to save the Docker Compose file for the Plex container.
Change directory into the new directory and create a Docker Compose file.
Paste the Plex Docker Compose configuration into the file. This Docker Compose file references the Docker container detailed in the referenced Docker Hub link below.
# Plex Server
# https://hub.docker.com/r/linuxserver/plex
#
# Notes:
# - Web server is found at http://<your-ip>:32400/web
# - Media files are stored on a NAS
# - A path to the NAS is mounted as /media-share
version: "3"
services:
plex:
image: lscr.io/linuxserver/plex:latest
container_name: plex
network_mode: host
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Copenhagen
- VERSION=docker
- PLEX_CLAIM= #optional
volumes:
- /opt/plex:/config
- /media-share/tv:/tv
- /media-share/movies:/movies
restart: unless-stopped
Start the Docker container¶
Run the Docker Compose command to start the container and include the -d
so it runs it as detached from the CLI.
Connect to the Plex web interface¶
Connect to the plex server¶
As part of the Plex setup you can browse to the media files using the media
folder that is mapped to the media-share
mount point.