How to migrate Plex from Synology to Docker while keeping your metadata and watched stats

Migrating Plex

Synology Aug 23, 2021

...From Synology to Docker

UPDATE: This post was written in the early days of DSM 7, however the methods for migrating your PMS to docker are still the same

Given the challenges the Plex team has faced in delivering a stable native Synology package from DSM 6 through the various beta and RC versions of DSM 7, some people currently using the native Synology package may want to move to a container.

The first thing you'll need to do is get a docker-compose file ready to go. Here's a sample which you can modify to fit your needs:

    container_name: plex
    restart: unless-stopped
      driver: json-file
# uncomment the next network line if you want to use the host network instead of a bridge network or your own specified network
#   network_mode: host
      - 32400:32400 #needed for all installs
# uncomment the ports below (remove the #) if you use a bridge network 
#      - 3005:3005/tcp
#      - 8324:8324/tcp
#      - 32469:32469/tcp
#      - 32410:32410/udp
#      - 32412:32412/udp
#      - 32413:32413/udp
#      - 32414:32414/udp
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
      - UMASK=002
      - ARGS=
      - DEBUG=no
      - ADVERTISE_IP= #optional
      - ALLOWED_NETWORKS= #optional
      - /etc/localtime:/etc/localtime:ro
      - $DOCKERDIR/plex:/config:rw
      - $MEDIADIR/media:/data/media:rw
      - /tmp:/transcode:rw
      - /dev/dri:/dev/dri
Sample Plex Docker Compose
Be aware that if you're still using default port 32400 on your incumbent Plex install, you will not be able to install the containerized Plex instance on the same port. You can get around this by initially changing the container port to something else (say 32500) until you've deleted the original Plex server from your system, then changing the container to 32400 for final testing of remote access
  • Disable "empty trash" on the  original (first) server, then stop that server
  • Get your Plex Claim token. You can do this by visiting Once you sign in (if necessary) you will be shown a code. Note that this is only valid for 4 minutes, so you will need to create your container within 4 minutes of visiting the claim page
  • Spin up your new server and complete setup without creating the libraries
  • Make sure you are on the latest version
  • Log out of the new server/container, then stop it
  • Transfer the full contents of the Plex Media Server folder including the preferences file from the old server to the new container's /config directory. In my case this was /volume1/docker/plex. If you're unsure where yours is, search for the folder which includes preferences.xml and copy to that folder
  • Start up the new server
  • Add the libraries and scan so content is added
  • Remove the old library paths (if necessary and your library paths are different between instances/syno package vs docker)
It is VERY important that you add your libraries before you remove your old ones. If you do this the wrong way round, you will lose your metadata and watched statistics
  • Clean up bundles, set your optimization settings, and enable trash
  • Log your clients out and in, if necessary, to get connections to re-bind

You should now have a fully functioning Plex server now in docker!

Relay Server and Quality

By default, Plex enables use of its own relay server when you or a user are connecting to your Plex Media Server from outside of your local network (see Plex Remote Access for more information).

This relay server may be utilized for a number of reasons related to accessibility of your own server, and is essentially a type of tunnel or VPN which both your server and client connect to to stream your content. If you have enabled secure connections, it is still secure as all control and certificates are held on your server only.

There is however a downside to this, and this relates to speed and quality. When going through a relay, non-Plex Pass users are limited to a download speed of 1Mbps, with Plex Pass subscribers getting 2Mbps. The latter is technically suitable for 720p streams, but not great.

To get around this, you can disable the use of this relay function on your Plex Media Server.

  1. Log in to your plex web app
  2. Navigate to settings
  3. In the navigation pane on the left, select Network
  4. Scroll down to where it says Enable Relay and
  5. Uncheck the box
How to disable the Relay Server
by disabling the relay, you may find that your server becomes unresponsive when outside your local network. You should test this yourself rather than rely on the information shown on the Remote Access page, as this has been proven to be unreliable in the past

Transcoding from the container (for Synology users)

Some Synology users have had difficulty using hardware to transcode, meaning their CPU usage skyrockets during a single stream. The container above has the following lines which should have allowed plex to use hardware for transcoding:

	- /dev/dri:/dev/dri

However for some reason it doesn't always seem to work. Below is how to fix this.

Important: transcode options are only available to server owners who have Plex Pass. If your server account does not have a Plex Pass, you may have more difficulties which the below won't solve.

Also just as important: only Synology devices with Intel CPUs supporting Quick Sync can use hardware transcoding. If you have a model newer than the DS920+, or one that has an AMD CPU, chances are your NAS won't support it unfortunately. 

First up, some basics. You will need to know:

  1. That your machine's Intel processor supports Quick Sync (google it). If you don't have an Intel processor, or it doesn't support it, you can check out Plex's article on that here
  2. How to access your docker gui
  3. How to map a transcode folder (if you followed the sample compose file above then this will already have been done)
  4. How to access SSH on your machine
  5. That by doing this, you are opening your device drivers up to the rest of your system, and is therefore potentially less secure
For the purposes of the following, I am going to assume that your Plex information is stored in /volume1/docker/plex. Change this as necessary to match your own folder setup

SSH into your machine and type in the following:

cd /dev/dri/
ls -l

This should return something like this:

total 0
crw------- 1 root root 226,   0 Jun  3 18:32 card0
crw------- 1 root root 226, 128 Jun  3 18:32 renderD128

This shows that there are no group permissions outside of the root user.

We will now create a script to ensure that these permissions get changed every time the NAS boots up:

  1. Navigate to your plex folder and create a file called
  2. Edit it in your favorite way (I normally do this through a mapped drive to my windows machine) and add the following lines:
sudo chmod 666 /dev/dri/card0 /dev/dri/renderD128
  • In DSM, navigate to Control Panel -> Task Scheduler
  • Click Create -> Triggered Task -> User-defined Script
  • Check the Enabled button, name the task (e.g. PlexDevicePermissions), set user to root and set event to Boot-up
  • Add the following script and press ok:
bash /volume1/docker/plex/
  • Trigger the task manually
  • Going back to our SSH terminal, we run ls -l again and it should now return the following, showing us that groups and users have read/write permissions:
total 0
crw-rw-rw- 1 root root 226,   0 Aug  3 18:34 card0
crw-rw-rw- 1 root root 226, 128 Aug  3 18:34 renderD128
We're nearly there, just a few more steps!

The following requires you to stop the container, recreate your settings, remove and then recreate the container. This won't be a problem as we're not changing any configuration mappings, only adding some device driver settings.

  • In DSM, navigate to your Plex container in the Docker GUI
  • Stop the container then hit Settings -> Export
  • Select Export Container Settings and hit ok. This will export a plex.json file
  • Open the file with your editor, scroll to the heading "devices"
  • Copy-paste the following, making sure that the drivers are the same names as when you ls -l in cd /dev/dri, then save:
"devices" : [
     "CgroupPermissions": "rwm",
     "PathInContainer": "/dev/dri/card0",
     "PathOnHost": "/dev/dri/card0"
     "CgroupPermissions": "rwm",
     "PathInContainer": "/dev/dri/renderD128",
     "PathOnHost": "/dev/dri/renderD128"
  • Remove your existing Plex container
  • In the Docker GUI, hit Settings -> Import, name your container the same as the one you just removed
  • Start the container and test by playing a file on a device which requires transcoding. When you see the little (hw) after Transcode, success!
In the Video line you can see (hw) next to Transcode


PTS fell down the selfhosted rabbit hole after buying his first NAS in October 2020, only intending to use it as a Plex server. Find him on the Synology discord channel

Have some feedback or something to add? Comments are welcome!

Please note comments should be respectful, and may be moderated