Skip to content

Plex in Container Manager on a Synology NAS (Hardware Transcoding)

Important or Recent Updates
Historic UpdatesDate
New DSM7.2 Container Manager Update 01/05/2023
Added additional security option to the compose to restrict the container from gaining new privileges as well as umask variable25/10/2023
Somehow at some point a paragraph about forwarding port 32400 went missing, I have never added it! But it’s in now!!13/06/2024
Historic Updates

In this guide I am going to take you through the setup of Plex in Docker using Container Manager.

Plex Pass

You will only benefit from hardware transcoding if you have an active Plex Pass either monthly or lifetime. If you don’t have one you can either follow this guide or jump over to the non hardware transcoding version.

Does my Synology support Hardware Transcoding?

Before we do anything else, you need to make sure your model of Synology has hardware transcoding capabilities. You need to do a quick lookup via the linked Google Sheet below, this is updated by Plex and makes it super easy to look up your model of NAS.

If you find that hardware transcoding is not available on your model you can jump back over to the standard guide on the menu.

Let’s Begin

As usual, it’s important you complete the two proceeding guides which will get your folder structure and docker, user setup.

Folder Setup

Let’s start by getting some folders set up for the container to use. Open up File Station create the following.

Folders
/docker/projects/plex-compose
/docker/plex

Container Manager

Next we are going to set up a ‘Project’ in Container Manager. Open up Container Manager and click on Project then on the right-hand side click ‘Create’.

In the next screen we will set up our General Settings, enter the following:

SectionSetting
Project Name:plex
Path:/docker/projects/plex-compose
Source:Create docker-compose.yml

Next we are going to drop in our docker compose configuration copy all the code in the box below and paste it into line ‘1’ just like the screenshot.

YAML
services:
  plex:
    image: linuxserver/plex:latest
    container_name: plex
    network_mode: host
    environment:
      - PUID=1234 #CHANGE_TO_YOUR_UID
      - PGID=65432 #CHANGE_TO_YOUR_GID
      - TZ=Europe/London #CHANGE_TO_YOUR_TZ
      - UMASK=022
      - VERSION=latest
      - PLEX_CLAIM= #Your Plex Claim Code
    volumes:
      - /volume1/docker/plex:/config
      - /volume1/data/media:/data/media
    devices:
      - /dev/dri:/dev/dri
    security_opt:
      - no-new-privileges:true
    restart: always

A note on Network Mode

You will notice that for Plex we don’t put it on the normal bridge network, this is because DSM reserves the DLNA ports Plex requires in order to use DLNA. So we run in Host mode, so it can share the ports.

Environment Variables

We need to make some changes in order for the container to have the correct permissions to save its configuration files and to have access to your media.

VariableValue
PUID(required) The UID you obtained in the user setup guide
PGID(required) The GID you obtained in the user setup guide
TZ(required) Your timezone wikipedia.org/wiki/List_of_tz_database_time_zones
PLEX_CLAIMPlease note the PLEX_CLAIM variable is optional and not always required. You can remove this line if you don’t need it or come back and add it if you are unable to sign in to your server on start up.

To get the code go to https://plex.tv/claim and sign in, then put the code you receive after the ‘PLEX_CLAIM=’. You have 4 mins to finish the guide after doing this, so best to grab it just before running the project.

Volumes

I have pre-filled this section to pass the correct paths, the only thing that you may need to change is the /volume1/ if your file paths are on a different volume.

Click ‘Next’

You do not need to enable anything on the ‘Web portal settings’ screen click ‘Next’ again.

On the final screen click ‘Done’ which will begin the download of the container images and once downloaded they will be launched!

The image will now be downloaded and extracted. You should see ‘Code 0’ when it has finished.

You will now see your Plex running and should have a green status on the left-hand side.

Firewall Exceptions

(Skip if you don’t have the Firewall configured)

If you have enabled and configured the Synology Firewall you will need to create exceptions for any containers that have a Web UI or have any incoming or outgoing connections. This section covers the basics of how to add these. (Please note this is a generic section and will not show the specific ports used in this guide however it applies in the same way)

Also, I would like to refer people to the great guide on getting the Firewall correctly configured over on WunderTechs site.

Head into the Control Panel> Security > Firewall, from here click Edit Rules for the profile you set up when you enabled the Firewall.

Next click on Create and you will see the screen below. Source IP and Action will be automatically selected to All and Allow, I will leave it up to you as to your own preference on whether you want to lock down specific Source IPs from having access. In this example we will leave as All.

You will now choose ‘Custom‘ and then the Custom button

Now select Destination from the drop-down menu, most web based containers require TCP access but check the guide as it will show the port and protocol. Then add comma separated ports. Then press OK.

Click OK a couple of times to get back to the main screen. You will see by default the new rule is added to the bottom of the list. You must always have your Block All rule last in the list as the rules are applied top down so move your container up.

You have now completed the Firewall changes and can continue with the guide.

Port Forwarding

In order to use Plex remotely and stream your local media you need to forward port 32400 from your Router to the NAS IP on the same port. This varies for everyone’s router so check the manual on how to do this.

Plex Initial Setup

After a few minutes you should be able to access the server and go through the Plex setup by going to the IP of your NAS in your browser followed by port 32400/web/

e.g. 192.168.0.45:32400/web/

You will be asked to sign in or sign up for an account if you don’t have one already.

You should now be able to add your media which will be in the /data/media folder within Plex

Once you have got to the main Plex interface make sure you go into the settings and turn on

  • Enable HDR tone mapping
  • Use hardware acceleration when available
  • Use hardware-accelerated video encoding

That’s it you are all setup. When a new server update is available you will just need to restart the container, and it will automatically download the latest update.


Looking for some help, join our Discord community

If you are struggling with any steps in the guides or looking to branch out into other containers join our Discord community!

Buy me a beverage!

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running things or just lets me stay hydrated. Plus 10% goes to the devs of the apps I do guides for every year.

Published inPlex 7.2

84 Comments

  1. Dreamsuite71 Dreamsuite71

    Thank you for your guides!
    Can you have plex behind gluetun to take advantage of vpn? I use expressvpn and I can’t figure out how to get Plex active by setting the vpn on network synology nas.
    Thank you

    • Dr_Frankenstein Dr_Frankenstein

      You could, but would need to have the port forwarded by your VPN provider if that is something you can do, otherwise you will struggle to get a connection.

  2. Gary Gary

    Thanks again for all your hard work… Very much appreciated.
    on my 918+ I don’t get hw transcoding with:

    devices:
    – /dev/dri:/dev/dri

    I changed to the following (with zero understanding on my part, just cut and paste from elsewhere):

    devices:
    – /dev/dri:/dev/dri
    – /dev/dri/renderD128:/dev/dri/renderD128
    – /dev/dri/card0:/dev/dri/card0

    Now hw transcoding works perfectly…
    ?
    Thanks again

    • Dr_Frankenstein Dr_Frankenstein

      Some of these things are a mystery lol, as in theory the container is looking at the same paths mounted 3 ways… the key thing is that its working 🙂

  3. Trevor Trevor

    Hi Dr F!

    First off thanks so much for these breakdowns. They have been awesome to follow so far! I have successfully set up all the Arrs with your help.

    That being said, I set up my plex server following the guide to no avail. I then installed the Plex App I previously used from the synology app store.

    Either way, when I go to add the libraries my original MEDIA folder shows up but my newly created data/media folder you had me create doesn’t show up. Any ideas?

    • Dr_Frankenstein Dr_Frankenstein

      In both instances it is likely permissions, with the Plex ‘App’ you need to visit the Shared Folder section in the Control Panel, Edit the ‘data’ share and then in the drop down list in the System Users you need to choose Plex and grant it access.

  4. pmd pmd

    What is the advantage of having Plex (h/w transcoding) in Docker if you’ve already got it up and running directly on the Synology using the latest packages from Plex (not the old Synology package manager ones)?

  5. Sanjay Sanjay

    I needed help with a Plex server update. I currently have Plex 1.29 installed, but the Plex app is displaying a new Plex 1.32 update. I have downloaded the .spk file. I have tried manual installation of the Plex server, but encountered an error: Port 32400 configured for this package is either used by another service or reserved for system use. Please modify or disable the conflicting service, or contact the developer to modify the package configuration.

    I have tried rebooting my NAS after the manual install, but this hasn’t corrected the problem. I have tried deleting plex from the system and am trying a fresh install. Any help would be appreciated.

    • Dr_Frankenstein Dr_Frankenstein

      Hey, it sounds like you are trying to install the package version of Plex. Do you have the Docker version running?

      If it’s the Docker version take a look at my Container Update guides on the left menu to get things updated.

      • Sanjay Sanjay

        Thank you for the fast reply! I removed the Plex package from the NAS. I followed the instructions to setup the docker containers. It updated the Plex server, and my files and everything showed up properly.

        I’ll look at the container update guides. I got confused because Plex web app had recommended I update the Plex server, and had forgotten about how I setup the docker containers to begin with.

        Anyways, I think its all working again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!