Docker support (solved)

plexconnect

#1

One of the most interesting ways to install PlexConnect in a platform independent way is to use dockers. Several users created their own forks, and even suggested pull requests to the iBaa repo to make this an easier task.

I'm not a docker user myself, due to the fact that I have PMS and PlexConnect installed in the same QNAP, and when I install dockers this can "confuse" PMS to use the wrong IP interface. So, until Plex Inc. finds a way to bind PMS to a certain NIC, I'm stepping away from dockers (some users have reported that PlexConnect does not "like" multiple NIC's either, but that's a matter for a separate thread, if needed).

But recently I have given the "power" to accept pull request into the iBaa repo, therefore I'm willing to apply changes that can enhance PlexConnect experience in docker environments without disrupting PlexConnect to the remaining users, and even updating the wiki pages for a docker installation.

The objective of this post is to open a discussion where we can select the best technical alternative, document it, and put in the wiki. Can I have your ideas, please ?


#2

@moody_blue said:

I’m not a docker user myself, due to the fact that I have PMS and PlexConnect installed in the same QNAP, and when I install dockers this can “confuse” PMS to use the wrong IP interface. So, until Plex Inc. finds a way to bind PMS to a certain NIC, I’m stepping away from dockers (some users have reported that PlexConnect does not “like” multiple NIC’s either, but that’s a matter for a separate thread, if needed).

There would be no issues running both PMS and PlexConnect on the same server on the same ip. They use different ports. I do however put Plexconnect on a different ip because it uses 53 (DNS), 80 (HTTP) and 443 (HTTPS) which are not uncommen ports… On a linux install its easy to target different NICs / macvlan… Not sure about other platforms.

When it comes to choosing PMS in docker i would highly recommend:
https://hub.docker.com/r/linuxserver/plex/

I currently maintain two docker images:
https://hub.docker.com/r/izzno/unraid-plexconnect/
https://hub.docker.com/r/izzno/plexconnect/

I am maintaining an unRAID server for a friend and running the “normal” image myself.

These require no modification of plexconnect, and will most likely never do so. They pull the source directly from git and autoupdate on every restart.

So I guess what I am saying is the only thing necessary would be to update the wiki on docker usage and choose an “official” docker image.


#3

The issue come up with ips when you don’t want to run with --network=host i am looking into a better way to deal with this


#4

Just run with “-p 53:53 -p 80:80 -p 443:443” instead…


#5

the dns will bind to the internal ip


#6

Yes, of course.


#7

Please help me understand what’s the best alternative to make everybody happy.

Link to github https://github.com/iBaa/PlexConnect/pull/521


#8

Then the dns server will respond with the wrong redirect ip e.g the internal ip is say 172.17.0.2 then the dns server will tell the client that trailers.apple.com is at 172.17.0.2 but thats the internal ip not the docker host ip so is inaccessible to the client on the lan network. the dns server needs to send the ip of the docker host machine.

@izznogooood said:
Yes, of course.


#9

I think I know what you mean.

I dont have your problem but I can look in to it.

When it comes to merging your code I would wait.

If you are having issues with any of my images you should post here:


#10

i run my own docker image for security reasons and thats what i don’t run as net host


#11

@Ghill13 said:
the dns server needs to send the ip of the docker host machine
This is a comment from @baa in Settings.cfg

IP_self: enable_plexconnect_autodetect, ip_plexconnect - manual override for VPN usage

So why don’t you put the required IP in ip_plexconnect and code enable_plexconnect_autodetect=False ? Because you want to use a hostname ? I can change the code to use hostname, if necessary.


#12

please read this post this one has nothing to do with the host name

@Ghill13 said:
Then the dns server will respond with the wrong redirect ip e.g the internal ip is say 172.17.0.2 then the dns server will tell the client that trailers.apple.com is at 172.17.0.2 but thats the internal ip not the docker host ip so is inaccessible to the client on the lan network. the dns server needs to send the ip of the docker host machine.

@izznogooood said:
Yes, of course.

@moody_blue said:

@Ghill13 said:
the dns server needs to send the ip of the docker host machine
This is a comment from @baa in Settings.cfg

IP_self: enable_plexconnect_autodetect, ip_plexconnect - manual override for VPN usage

So why don’t you put the required IP in ip_plexconnect and code enable_plexconnect_autodetect=False ? Because you want to use a hostname ? I can change the code to use hostname, if necessary.


#13

Let me see if I understand. We have 3 different services:

  1. PMS listening to port 32400
  2. PlexConnect DNS listening to port 53
  3. PlexConnect WebServer listening to ports 80 and 443

These services can be on the same IP or separate ones.

When users select trailers in the ATV the request will be sent to 2. above. That DNS service inspects the request, and if trailerspasses it to the service whose base IP is ip_plexconnect (if enable_plexconnect_autodetect=False is also specified), otherwise passes it to DNS running on IP defined by ip_dnsmaster. Therefore it’s possible to have DNS and WebServices running on two different IP’s, although I don’t see a reason for that, except in the case where the machine has several NIC’s (or a VPN “nic” plus a HW one), that’s why (I think) @baa created new parameters in Settings.

Then the WebServer processes the request, and interfaces all communications between ATV and PMS (that was discovered through various processes, one of them is using ip_pms).

What is different in a docker situation ? If this is a DNS issue in some docker situations, why don’t you create a docker with an embedded DNS server and deactivate PlexConnect’s one ? Any DNS service out there will be faster and more reliable than PlexConnect’s DNS service, which is written in python. Or use dnsmasq instead ?

From what I read in this thread @Ghill13 seems to have an issue with the current PlexConnect version but @izznogooood doesn’t. How can I make both happy ?


#14

The difference is docker puts plexconnect behind NATed network by default (unless you “–network=host”). I dont have this issues because I run most my containers of bridges. I dont want to change my image either as its simple an works :).

Please look at: https://github.com/varju/docker-plexconnect

The difference with this image is he applies a patch to plexconnect at build time resolving your issue. Plexconnect is also pulled upon image creation meaning if there is updates and he does not push a new image you will not get them.

If you should apply this patch to plexconnect main i dont know, but i dont think it matters, but i would do some testing with a dev branch.


#15

i already have my own version of that patch working in my plexconnect fork but would like it in the main plexconnect for other users


#16

@Ghill13 said:
i already have my own version of that patch working in my plexconnect fork but would like it in the main plexconnect for other users
That’s what I want to do. Can we discuss today in Slack ? 9PM Lisbon/London time, one hour later for @izznogooood if he wants to join ?


#17

All pending requests related with dockers have been applied.

Special thanks to @Ghill13 and @izznogooood