Plex: Self-Hosted Media Server for Streaming

18-08-2024 - 1 minute, 54 seconds -
documentation media plex streaming self-hosted docker

Setting Up Plex with Docker

Introduction

Plex is a powerful media server that organizes your media libraries and streams them to any device. This guide will cover setting up Plex on Docker, including the configuration of external storage via SMB/CIFS for media files.

Prerequisites

  • Docker and Docker Compose: Ensure Docker and Docker Compose are installed on your system.
  • Plex Account: You need a Plex account to obtain a Plex Claim Token for initial server claim. Get your Plex Claim Token.

Setting Up Plex on Docker

1. Create a Docker Compose File

Construct your docker-compose.yml with the necessary service definitions:

version: '2'
services:
  plex:
    container_name: plex
    image: plexinc/pms-docker:latest
    restart: unless-stopped
    ports:
      - 32400:32400/tcp
      - 8324:8324/tcp
      - 32469:32469/tcp
      - 1900:1900/udp
      - 32410:32410/udp
      - 32412:32412/udp
      - 32413:32413/udp
      - 32414:32414/udp
    environment:
      - TZ=US/Central
      - PLEX_CLAIM=********
    hostname: plex-hostname
    volumes:
      - ./config:/config
      - ./transcode:/transcode
      - nas-share:/media

volumes:
  nas-share:
    driver_opts:
      type: cifs
      o: "username=administrator,password=********"
      device: "//2k22-host/bucket/documents/"

Sensitive Data Removed: Plex Claim Token and password for SMB/CIFS share.

2. Launch Plex Server

Deploy Plex using the following command:

docker-compose up -d

This will start the Plex container and expose the necessary ports for remote access and communication.

3. Accessing Plex

Once Plex is running, access it through:

http://localhost:32400/web

or by navigating to your server's IP at port 32400 in a web browser.

Configuring External SMB/CIFS Storage

To use an SMB/CIFS share as your media storage:

  • Configure the share on your network storage or NAS with appropriate permissions.
  • Mount the share in Plex using the volumes directive in your docker-compose.yml file.
Example of SMB/CIFS Configuration
volumes:
  nas-share:
    driver_opts:
      type: cifs
      o: "username=administrator,password=********"
      device: "//2k22-host/bucket/documents/"

Extended Setup and Configuration

Hardware Transcoding

If your system supports hardware transcoding, you can enable it in Plex's settings under Transcoder. This feature improves streaming performance by using the GPU rather than the CPU.

Updating Plex

Keep your Plex server updated through Docker Compose:

docker-compose pull
docker-compose up -d

These commands will fetch the latest Plex Docker image and restart your containers.

Resources and References

Conclusion

With Plex running on Docker, you have a robust solution for managing and streaming your media library efficiently. This setup provides the flexibility to scale and adapt your media server to meet changing needs, such as integrating additional services.