Page cover image

Plex Media Server

Running Plex Media Server on Raspberry Pi using Docker

Plex Media Server is a powerful media streaming solution that allows you to stream your video, music, and photo collections to various devices.

Running Plex Media Server on a Raspberry Pi using Docker provides a convenient and efficient way to set up and manage your media server. This documentation will guide you through the process of running Plex Media Server on your Raspberry Pi using Docker.

Docker Networking

Before creating your Plex Media Server container, you need to decide on the type of networking you want to use. Docker offers three main types of networking:

Bridge (default): Creates a new network within the host and runs containers within it. The containers are connected to the physical network via an internal router, and Docker configures this router to forward certain ports to the containers.

Host: Uses the IP address of the host running Docker, making the container's networking appear to be the host rather than separate.

Macvlan: Creates a new virtual computer on the network, which is the container. This networking type is similar to the host networking in terms of configuration.

For running Plex Media Server, using host or macvlan networking is generally easier and has fewer issues compared to bridge networking.

Running the Plex Media Server Container

To run the Plex Media Server container on your Raspberry Pi, you can use the docker run command with the appropriate parameters. Here's an example command using host networking:

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

Let's break down the important parameters:

  • -d: Runs the container in detached mode, meaning it runs in the background.

  • --name plex: Assigns a name to the container for easy identification.

  • --network=host: Uses the host networking mode.

  • -e TZ="<timezone>": Sets the timezone inside the container.

  • -e PLEX_CLAIM="<claimToken>": Specifies the claim token for the server to obtain a real server token. You can obtain a claim token from https://www.plex.tv/claim.

  • -v <path/to/plex/database>:/config: Mounts the host directory for storing Plex Media Server configuration data.

  • -v <path/to/transcode/temp>:/transcode: Mounts the host directory for storing transcoder temporary files.

  • -v <path/to/media>:/data: Mounts the host directory containing your media files.

  • plexinc/pms-docker: Specifies the Docker image to use for the Plex Media Server.

Configuration

When running the Plex Media Server container for the first time, you can set additional configuration options using environment variables. Some recommended parameters include:

  • HOSTNAME: Sets the hostname inside the Docker container.

  • PLEX_UID and PLEX_GID: Sets the user ID and group ID of the Plex user created inside the container.

  • CHANGE_CONFIG_DIR_OWNERSHIP: Changes the ownership of the config directory to the Plex user (defaults to true).

  • ALLOWED_NETWORKS: Specifies IP/netmask entries that allow access to the server without requiring authorization.

Useful Commands

Here are some useful Docker commands for managing your Plex Media Server container:

  • Start the container: docker start plex

  • Stop the container: docker stop plex

  • Shell access to the running container: docker exec -it plex /bin/bash

  • View container logs in real-time: docker logs -f plex

  • Restart the container and upgrade to the latest version: docker restart plex

Hardware Transcoding Support

If your Raspberry Pi has a supported CPU with Intel Quick Sync, you can enable hardware transcoding in your Plex Media Server container. To do this, you need to pass the relevant kernel device to the container using the --device parameter:

docker run \
-d \
--name plex \
--network=host \
-e TZ="<timezone>" \
-e PLEX_CLAIM="<claimToken>" \
-v <path/to/plex/database>:/config \
-v <path/to/transcode/temp>:/transcode \
-v <path/to/media>:/data \
--device=/dev/dri:/dev/dri \
plexinc/pms-docker

After starting the container, you can enable hardware acceleration in the Plex Media Server settings.

Conclusion

Running Plex Media Server on a Raspberry Pi using Docker provides a convenient and efficient way to set up and manage your media streaming server.

By following the steps outlined in this documentation, you can easily configure and run Plex Media Server on your Raspberry Pi, enabling you to stream your media collection to various devices.

Remember to choose the appropriate networking mode, configure the necessary parameters, and mount the required directories for a smooth experience. With the power of Docker and Plex Media Server, you can enjoy your media on your Raspberry Pi and share it with others.

Last updated

Was this helpful?