[ updated 10-30-2016 | Upgraded Plex to plexmediaserver- and CentOS ]

Recently I tried setting up a Plex server in a docker container. The first problem was the bind which required logging in locally or port forwarding. After doing this once, I realized that you could use the Preferences.xml file, but that meant that you couldn’t truly automate this/deploy it elegantly in a docker container. And what if you wanted to run other servers — for friends? I finally figured out how to do this in the most elegant way possible.

First – Grab your Unique Plex Access Token

Login at https://app.plex.tv/web/app with your username and password
Open your javascript console (in Chrome: View -> Developer -> JavaScript Console)
and type:

Note the token, which will look like this: “PZwoXix8vxhQJyrdqAbY”

At this stage DO NOT click log out of your account until you register the new server. Otherwise your token will regenerate.
Once you register the server, it won’t matter after that if the token changes.

Grab my Docker Image

Check out: https://hub.docker.com/r/ventz/plex/
You can pull it down by doing:

Setup a DATA directory

Create a DATA directory (let’s assume it’s “/plex”) which contains:
1.) a folder called “Plug-ins” –> this has all your plugins from: https://github.com/plexinc-plugins or any other source.
2.) a file called “Preferences.xml”

The “Preferences.xml” file should contain:

note: Edit out “PZwoXix8vxhQJyrdqAbY” with the AccessToken for the account you want to use!

This will end up being mounted over:
1.) /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins
2.) /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml

Run Plex in a Docker Container on a VPS without backend setup/port forwarding

This will mount your /plex/{Plug-ins, Preferences.xml} into /p on the container, and then the default CMD on the container is “/start-plex.sh” which will chmod them, move them into the right places, and then start the server.

At this point, go to the Docker HOSTS’ IP address (or the Public IP that NATs to the internal IP) at: “http://dockerhostIP:32400/web”, and log-in with your Plex account. You will now see a NEW server registered, and you will be able to browse the channels that you have pushed + watch content 🙂

OPTIONAL – How to Build your own Docker image

Let’s say you don’t trust some random image by some random person (me). No problem – here’s how to build your own “ventz/plex” Docker image.

[ updated 10-30-2016 | Upgraded Plex to plexmediaserver- and CentOS ]

Make sure your Dockerfile has:

and Finally, make sure your “start-plex.sh” has:

Now, BUILD it:

Enjoy! 🙂

Leave a Reply

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

Post Navigation