Return to Level1Techs.com

Plex with docker

I´m currently trying to get PLEX working in a docker container.

I tried the x86 image from linuxserver.io, like

sudo docker create
–name=plex
–net=host
-e VERSION=latest
-e PUID=1000 -e PGID=1000 \ NOTE: that´s the User Id and group id of my admin user
-e TZ=Europe/Vienna
-v /home/max/config:/config
-v /home/max/raid6/Media/Movies:/data/movies
-v /home/max/plex_transcode:/transcode
linuxserver/plex

witch I wasn´t able to access from outside the container at all (but it sure did something in the config folder)

and then I tried without --net=host and replaced it with

-p 32400:32400
-p 32400:32400/udp
-p 32469:32469
-p 32469:32469/udp
-p 5353:5353/udp
-p 1900:1900/udp

Using that I (can) access port 32400, where before I could not and it does load some plex page at 192.168.1.111:32400, but it just sais “searching for server”, forever. This is the page i´m looking at. (The greenshot edits didn´t work out so well… the top one sais looking for server in german and the bottom one is download plex server. Meanwhile I was under the impression I just installed a plex server)

The host OS is centos. I have already disabled selinux and firewalld, but it does not change anything.

Has anyone here already tried getting plex running in docker and suceeded / actually using it in docker?

I´ll probably be able to get it running at some point (I think). But at this current point in time I´m pretty clueless about what the problem could be. So any help would be highly appriciated.

So, it’s likely disabling firewalld is causing your issue. Try the following:

firewall-cmd --permanent --zone=trusted --change-interface=docker0
firewall-cmd --reload
systemctl restart docker

After that, --net=host should work and you should have a better experience.

2 Likes

Still isn´t reachable with --net=host. Why do you think disablling firewalld is the issue?

If you are trying to access Plex from Windows PC and it keeps searching for servers — try turning off Windows Defender or other AV software you use. Helped me.
Try --network=host instead of --net. Just try, may help, but maybe there is a --net synonym I don’t know about.

On my docker setup, every time I flush all the firewall rules everything goes pear shaped. Docker, by default, will add some iptables rules to expose the ports in your container, so if you flush the rules without restarting the docker daemon and the containers you can find yourself in a broken state. I so rarely use the host net (only twice that I can think of, in 5 years), I wasn’t sure if it was the same issue I’ve seen in the past.

It’s kind of an interesting problem. If you don’t fix it by tonight I think I’ll migrate my Plex server to docker and give it a look.

Extra reading if you’d like: https://docs.docker.com/v17.09/engine/userguide/networking/default_network/container-communication/

I just had 10 minutes free and gave it a shot on my nas (which is Ubuntu). It’s never had docker on it, so I just did a clean install apt-get install docker.io and then ran the following:

docker create \
 --name=plex \
 --net=host \
 -e VERSION=latest \
 -e PUID=1000 -e PGID=1000 \
 -e TZ=America/Chicago \
 -v /nas:/config \
 -v /nas/TV\ Shows:/data/tvshows \
 -v /nas/Movies:/data/movies \
 -v /tmp/transcode:/transcode \
 linuxserver/plex

docker start plex

It took a couple minutes to initialize (haswell Celeron with only spinning disks)

I hit the IP:32400/web and was told there was an unclaimed server on my network, hit claim, added my media libraries from the volumes mounted in the command, and it’s currently reindexing.

I’ll try again later on a centos vm to see if anything changes.

EDIT:

and now looking at the command you copy and pasted, and it looks like you may have some character interpolation going on. The double dashes appear as em-dashes in your pasted snippet. That might be the cause of your issue.

1 Like

I got it to work now too. Appeantly goofed and didn´t actually properly disable firewalld. -.-

With firewalld enabled I can get into the ui, but nothing works. So, just gotta figure out what to put in there.

I also didn´t know that you have to go to /web for the ui. Typing in only the port gave me a XML at first.

Added this file

<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>plexmediaserver</short>
  <description>Ports required by plexmediaserver.</description>
  <port protocol="tcp" port="32400"></port>
  <port protocol="udp" port="1900"></port>
  <port protocol="tcp" port="3005"></port>
  <port protocol="udp" port="5353"></port>
  <port protocol="tcp" port="8324"></port>
  <port protocol="udp" port="32410"></port>
  <port protocol="udp" port="32412"></port>
  <port protocol="udp" port="32413"></port>
  <port protocol="udp" port="32414"></port>
  <port protocol="tcp" port="32469"></port>
</service>

to /etc/firewalld/services/plexmediaserver.xml

Then these two commands

sudo firewall-cmd --add-service=plexmediaserver --permanent
sudo firewall-cmd --reload

Now it works with firewalld on too.

Thanks for the help! :slight_smile:

2 Likes