Skip to content

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

Last updated on 19 December 2023

Important or Recent Updates
Historic UpdatesDate
New DSM7.2 Container Manager Update01/05/2023
Guide rewritten moving to a Project rather than the slower method via the UI giving you more flexibility. Also includes updates to improve security which is only possible via projects.25/10/2023
Historic updates

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

This version of the guide does not enable the hardware transcoding features of your NAS, if it supports it I recommend following the other version from the menu (That version tells you how to check)

If you NAS does not support it, or you do not have a Plex Pass continue on below

Let’s Begin

In order to use this guide successfully you will need to complete the two preceding guides which will get your folder structure and Docker, user setup. In addition, if you already have the original Synology Plex Package installed you will need to uninstall it first.

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.

What on earth is a Docker Compose?
Docker Compose allows us to define how Docker should set up one or more containers within a single configuration file. This file is yaml formatted and Container Manager uses the Projects feature to manage them.

YAML
services:
  plex:
    image: linuxserver/plex
    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=
    volumes:
      - /volume1/docker/plex:/config
      - /volume1/data/media:/data/media
    security_opt:
      - no-new-privileges:true
    restart: unless-stopped

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.

Initial Plex 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 folder within Plex

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.


Buy Me a Coffee or a Beer

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 get the odd beverage. Plus 10% goes to the devs of the apps I do guides for every year.

Published inPlex 7.2

14 Comments

  1. Vitalii Vitalii

    Followed the guide and was able to run Plex container successfully and access via web (32400/web/). Plex was not able to detect videos, so I tried to rerun. However once stopped, cannot access it anymore. Container manager says it is running, but when I try to connect to web interface, it is saying “Can’t connect to the server”. So far tried to reinstall, change claim code, remove claim code – nothing works. I have Firewall turned off and running with the same config as the first time, but no luck. Any ideas what can I try to do to fix this?

    • Dr_Frankenstein Dr_Frankenstein

      Are there any clues in the container log at all as odd that you can’t get back in, also ensure if you had the Package version of Plex installed previously that it has been uninstalled.

      • Vitalii Vitalii

        Ok, seems like I was just checking Container Manager logs and had a feeling everything is fine. In container logs I have found way more useful info, bunch of this logs:
        2024/04/07 06:47:04 stderr PMS: failure detected. Read/write access is required for path: /config/Library/Application Support/Plex Media Server

        Since it is a permission issue I have applied Permission Fix #1 from your “Step 2: Setting up a restricted Docker user” guide, but did not help.

        Here is the more detailed logs since server started. Top 2 lines just keep repeating:
        2024/04/07 06:45:14 stderr PMS: failure detected. Read/write access is required for path: /config/Library/Application Support/Plex Media Server
        2024/04/07 06:45:14 stdout Starting Plex Media Server. . . (you can ignore the libusb_init error)
        2024/04/07 06:45:14 stdout [custom-init] No custom files found, skipping…
        2024/04/07 06:45:14 stdout No update required
        2024/04/07 06:45:14 stdout **** Server already claimed ****
        2024/04/07 06:45:14 stdout **** The app may not work properly and we will not provide support for it. ****
        2024/04/07 06:45:14 stdout **** Permissions could not be set. This is probably because your volume mounts are remote or read-only. ****
        2024/04/07 06:45:14 stderr /usr/bin/find: unknown predicate `-R’
        2024/04/07 06:45:14 stdout This could take some time
        2024/04/07 06:45:14 stdout Change in ownership detected, please be patient while we chown existing files
        2024/04/07 06:45:14 stdout
        2024/04/07 06:45:14 stdout ───────────────────────────────────────

        • Dr_Frankenstein Dr_Frankenstein

          I would delete the contents of the Plex folder, apply the fix and then Start up the project again, this gives it a clean start with folder permissions that match, also double-check the PUID and PGID are correct (right way around)

  2. Zodd Zodd

    Hello! Firstly, thank you for all of the work put into publishing and maintaining these guides. They have been invaluable in getting my first NAS media server up and running.

    I have run into some trouble with Plex remote access after configuring my Synology firewall. It seems to be capping streams to 2MB/s to users. Disabling the firewall appears to alleviate this issue.

    When trying to add the Plex container to the firewall’s list of exceptions, it was not listed as a built-in application that I could select. I instead manually selected the 32400 port. This was also the case for the vpn-gluetun project containers.

    Would you know why these two projects are not appearing as built-in applications? The other docker containers (nzbget and the servarr apps) I built using your guides do appear as options to forward. I believe the streaming issue is due to Plex’s remote access not having a manually-specified port of 32400 but the firewall exception only allowing that port.

    • Dr_Frankenstein Dr_Frankenstein

      Hey thanks for the feedback!

      I could probably do with seeing how you set the exception in the Firewall.. I will drop you an email if that’s OK.

      We (on Discord) recently found that on an update or restart that containers are being removed from the Firewall exceptions list! So I am just about to re-write the Firewall section on how to manually add them so they are permanent, so I would not worry about those containers not appearing as going forward it’s going to use a different method..

      • Jli Jli

        hey,
        First of all, thanks for all your hard work in making these guides. it really helped me setting things up.

        is there any news on the firewall rules disappearing? i notice i have the same issues.

        • Dr_Frankenstein Dr_Frankenstein

          Hey I changed the Firewall section to manually set the ports rather than add the Containers, this should result in them not vanishing, takes an extra bit of work due to removing the easier select and hit OK but should remain in place!

  3. Levi Levi

    Is there a benefit to using the container version of Plex instead of the package version?

    • Dr_Frankenstein Dr_Frankenstein

      Hey have a look back through the comments.. But in essence yes upgrades are easier with Docker as the Package relies on updates from Plex and in the past major system updates have caused issues with the package version. But ultimately it’s your preference ‘if it ain’t broke’ 🙂

  4. Michael Michael

    Thank you for the excellent guides! By the way, I think you mean:

    “In order to use this guide successfully you will need to complete the two preceding* guides.”

    • Dr_Frankenstein Dr_Frankenstein

      I will pop this in the guide as been asked a few times. It is recommended to run this one on host mode to ensure all ports are appropriately mapped. You can run in bridge mode but will need to manually assign all the ports.

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!