Debian Plex Dockerfile
This is a Dockerfile to set up "Plex Media Server" - (https://plex.tv/) running on Debian 8.
As in it's current release on Centos 7 and other distributions docker is not capable to bind to an NFS share already mounted on the host. Thus, this container is able to mount NFS shares directly.
Remote shares and the locally mapped folders are parameters to the container.
Build from docker file
git clone firstname.lastname@example.org:wwebers/debian-plex.git cd debian-plex docker build -t plex .
You can also obtain it via:
docker pull wwebers/debian-plex
Prepare your local data folders used by the container volumes:
- /config - Create an empty folder. Plex will store its library, meta-data, preferences and other stuff here
Instructions to run:
docker run -d --name plex --privileged -h *your_host_name* -v /*your_config_location*:/config --p *your_host_ip*:32400:32400 wwebers/debian-plex *your_nfs_server*:*/path/to/remote/share1*:*/data/share1* *your_nfs_server*:*/path/to/remote/share2*:*/data/share2* ...
In case you prefer to share the hosts network you can run the container with the following command (Though be aware this more insecure but should be fine on your personal servers.)
docker run -d --name plex --privileged --net="host" -v /*your_config_location*:/config --p *your_host_ip*:32400:32400 wwebers/debian-plex *your_nfs_server*:*/path/to/remote/share1*:*/data/share1* *your_nfs_server*:*/path/to/remote/share2*:*/data/share2* ...
The first time it runs, it will initialize the config directory and terminate.
http://*your_host_ip*:32400/web to run through the setup wizard.
Access to Plex from within the local network
You will need to modify the auto-generated config file to allow connections from your local IP range. This can be done by modifying the file in either of the following alternatives:
your_config_location/Plex Media Server/Preferences.xml
- By allowing general access from within your local network by adding
allowedNetworks="192.168.1.0/255.255.255.0"as a parameter in the <Preferences ...> section. (Or what ever your local range is)
- By generally disabling network authentication by adding
disableRemoteSecurity="1"as a parameter to the <Preferences ...> section.
Start the docker instance again and it will stay as a daemon and listen on port 32400.
Access to the installation wizard from outside the local network
Per default Plex demands listens on 127.0.0.1 (localnet) and demands authentication from outside. To overcome this during the initial configuration one can build a SSH tunnel from whatever host and use that one during the initial configuration.
ssh -f *your_docker_host* 2000:localhost:32400 -N
http://localhost:2000/webto run the initial configuration
Running the container under SELinux
Even though SELinux provides a lot to the security of Linux its currently quiet disturbing when running docker containers. Several commands demand either increased privileges or drop default capabilities already set by docker.
The current container does not run the plex-process with root-privileges. However, this demands the use of
su -s /bin/sh plex -s .... For that reason the container is started with the
Why not using NFS-shares already mounted on the host as volumes?
The current release used (1.3.2 on Centos 7) ignores the fact that we mounted a NFS share to a local directory. As a result, the container just sees an empty folder.
This seems to be a regression bug in the current docker release.