Migrating Plex
...From Synology to Docker
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:
services:
plex:
container_name: plex
image: ghcr.io/hotio/plex
restart: unless-stopped
logging:
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
ports:
- 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
environment:
- PUID=$PUID
- PGID=$PGID
- TZ=$TZ
- UMASK=002
- ARGS=
- DEBUG=no
- PLEX_CLAIM=${PLEX_CLAIM}
- ADVERTISE_IP= #optional
- ALLOWED_NETWORKS= #optional
- PLEX_PASS=${PLEX_PASS}
volumes:
- /etc/localtime:/etc/localtime:ro
- $DOCKERDIR/plex:/config:rw
- $MEDIADIR/media:/data/media:rw
- /tmp:/transcode:rw
devices:
- /dev/dri:/dev/dri
- Disable "empty trash" on the  original (first) server, then stop that server
- Get your
Plex Claim
token. You can do this by visiting https://www.plex.tv/claim/. 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 - in fact, don't touch your libraries at all for the moment
- 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 includespreferences.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)
- 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.
- Log in to your plex web app
- Navigate to settings
- In the navigation pane on the left, select
Network
- Scroll down to where it says
Enable Relay
and - Uncheck the box

Remote Access
page, as this has been proven to be unreliable in the pastTranscoding 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:
devices:
- /dev/dri:/dev/dri
However for some reason it doesn't always seem to work. Below is how to fix this.
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:
- 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
- How to access your docker gui
- How to map a transcode folder (if you followed the sample compose file above then this will already have been done)
- How to access SSH on your machine
- That by doing this, you are opening your device drivers up to the rest of your system, and is therefore potentially less secure
/volume1/docker/plex
. Change this as necessary to match your own folder setupSSH 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:
- Navigate to your
plex
folder and create a file calleddevicepermissions.sh
- Edit it in your favorite way (I normally do this through a mapped drive to my windows machine) and add the following lines:
#!/bin/sh
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 toroot
and set event toBoot-up
- Add the following script and press
ok
:
bash /volume1/docker/plex/devicepermissions.sh
- 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
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 aplex.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
incd /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!

Video
line you can see (hw)
next to Transcode
Have some feedback or something to add? Comments are welcome!
Please note comments should be respectful, and may be moderated