Plex Media Server

This guide was written for Synology DS1520+, but should work on any Linux-based system with Docker installed. Some steps may vary depending on your platform.

Installation

Prerequisites

Docker container

  1. Pre-download the latest docker image:

    Terminal window
    sudo docker pull ghcr.io/hotio/plex

    Normally we’d run sudo docker compose pull && sudo docker compose up -d after creating a docker-compose.yaml file, but we’ll be time limited by the PLEX_CLAIM_TOKEN in a later step.

  2. Create a new docker compose file:

    Terminal window
    nano docker-compose.yaml
  3. Copy and paste the following configuration into the file:

    docker-compose.yaml
    services:
    plex:
    container_name: plex
    image: ghcr.io/hotio/plex
    ports:
    - "32400:32400"
    environment:
    - PUID=1000
    - PGID=1000
    - UMASK=002
    - TZ=Etc/UTC
    - PLEX_CLAIM_TOKEN
    - PLEX_ADVERTISE_URL
    - PLEX_NO_AUTH_NETWORKS
    - PLEX_BETA_INSTALL=false
    - PLEX_PURGE_CODECS=false
    volumes:
    - /<host_folder_config>:/config
    - /<host_folder_transcode>:/transcode
    - /<host_folder_data>:/data
  4. Change PUID and PGID to the user and group ID you want the container to run as:

    docker-compose.yaml
    environment:
    - PUID=1000
    - PGID=1000

    tip You can find these by running id <username> on your host system.

  5. Change TZ to your local timezone. List of tz database time zones.

    docker-compose.yaml
    environment:
    - TZ=Etc/UTC
  6. Replace <host_folder_config>, <host_folder_transcode>, and <host_folder_data> with the paths to the directories on your host where you want to store Plex configuration files, transcoder temporary files, and media files respectively.

    docker-compose.yaml
    volumes:
    - /<host_folder_config>:/config
    - /<host_folder_transcode>:/transcode
    - /<host_folder_data>:/data
  7. Log into the Plex website and copy your claim token. This links your server to your Plex account automatically.

    docker-compose.yaml
    environment:
    - PLEX_CLAIM_TOKEN=<your_token_here>

    The PLEX_CLAIM_TOKEN is only valid for 4 minutes after being generated. Make sure to immediately start your container after copying the code.

  8. Save the file and start the container:

    Press Ctrl + O to save the file and Ctrl + X to exit.

    Recreate and start the Plex container:

    Terminal window
    sudo docker compose up -d
  9. Test your setup by navigating to http://<your_server_ip>:32400/web in your web browser. You should see the Plex web interface where you can complete the setup and add your media libraries.

  10. Forward the necessary ports on your router if you want to access Plex outside your local network. The default port is 32400.

Hardware-accelerated streaming

  1. Edit your docker-compose.yaml file to include the devices section to enable hardware transcoding:

    docker-compose.yaml
    services:
    plex:
    container_name: plex
    image: ghcr.io/hotio/plex
    ports:
    - '32400:32400'
    environment:
    - PUID=1000
    - PGID=1000
    - UMASK=002
    - TZ=Etc/UTC
    - PLEX_CLAIM_TOKEN
    - PLEX_ADVERTISE_URL
    - PLEX_NO_AUTH_NETWORKS
    - PLEX_BETA_INSTALL=false
    - PLEX_PURGE_CODECS=false
    volumes:
    - /<host_folder_config>:/config
    - /<host_folder_transcode>:/transcode
    - /<host_folder_data>:/data
    devices:
    - /dev/dri:/dev/dri
  2. Restart your Plex container to apply the changes:

    Terminal window
    sudo docker compose pull && sudo docker compose up -d
  3. Enable hardware acceleration

    To use Hardware-Accelerated Streaming in Plex Media Server, you need to enable it using the Plex Web App.

    1. Open the Plex Web app.
    2. Navigate to Settings > Server > Transcoder to access the server settings.
    3. Toggle Show Advanced in the upper-right corner to expose advanced settings.
    4. Enable Enable HDR tone mapping, Use hardware acceleration when available and Use hardware-accelerated video encoding.
    5. Click Save Changes at the bottom.
  4. To check to see if hardware acceleration is being used during a video playback:

    1. Play a video on any Plex app.
    2. In the quality settings of the Plex player app, reduce the video quality to force Plex Media Server to convert the video (for example, select Convert to 480p).
    3. Open the Plex Web App.
    4. In the Plex Web App, click on the Activity icon in the upper-right corner.
    5. Visit the Dashboard for the playing video
    6. Use the toggle at the top right of the Now Playing area to expose additional details of the playback
    7. When hardware acceleration is being used, you should see (hw) next to the Video format.

Troubleshooting

Buffering issues

If you encounter buffering during playback, make sure hardware acceleration is enabled and try increasing Transcoder default throttle buffer under Settings > Server > Transcoder to 600 seconds.

Playback on local network shows as remote

If playback on your local network is showing as remote, you may need to change the network mode of the container to host to allow Plex to correctly identify local network traffic.

Remote streams are limited to a lower bitrate compared to local streams, which can affect playback quality.

Edit your docker-compose.yaml file to include network_mode: host:

docker-compose.yaml
services:
plex:
container_name: plex
image: ghcr.io/hotio/plex
network_mode: host
ports:
- '32400:32400'
environment:
- PUID=1000
- PGID=1000
- UMASK=002
- TZ=Etc/UTC
- PLEX_CLAIM_TOKEN
- PLEX_ADVERTISE_URL
- PLEX_NO_AUTH_NETWORKS
- PLEX_BETA_INSTALL=false
- PLEX_PURGE_CODECS=false
volumes:
- /<host_folder_config>:/config
- /<host_folder_transcode>:/transcode
- /<host_folder_data>:/data

Plex support

For more detailed troubleshooting, please refer to the official Plex Support website.

References

The following sources were used while writing this guide: