Running multiple plex containers in Docker

Original: https://www.reddit.com/r/unRAID/comments/vo0qim/does_plex_need_to_be_run_in_host_mode/


When you have the network type “host” for a docker container then you are telling docker that the Image or container itself will manage the ports. This means that an -P or -p XXXX port assignment is ignored. Any port in the docker image marked with EXPOSED will be, well, exposed as port in the container with network type “host”.

Another thing to note here is that the container has the same IP as the host. So if your Host has the IP 192.168.0.5 then the container will also have that IP and the Ports are accessible directly on 192.168.0.5:XXXX

With the network type “bridge” this is a bit different. First, each container will get its own IP in the docker network, this can be 172.17.0.X. Unlike with network type “host”, you, who run the docker command, are responsible to expose the ports, not the image. This means that now the -P and -p parameters work and have to be used so that ports are being exposed. For plex, this can mean double or multiple NATing which can interfere with remote access.

In Unraid, the template is just a more user-friendly way to construct the docker run command (which also gets shown when you create a new container and click apply). In the template, you have the ability to add a new configuration like a port.

If no ports are being exposed in bridge mode then I would check the template if any ports are actually exposed. If not then you need to add them. In host mode, as said above, this is not necessary because it will do this on its own depending on what is defined in the image.

Lastly, this is specifically to Plex Media Server, I would recommend using Host mode here for its simplicity. Plex determines stream locations based on where you connect from through the IP that is accessing the server. If those IPs are not in the same network then Plex will consider them as remote streams and all of the settings in regards to remote streams (like quality) apply.

This means that even if your Plex client is on your TV, in the same room as your Plex Server, when you have the Plex Media Server running in a Docker container that has the network mode “bridge” then those IPs are not in the same network (even though they physically are) and plex considers that client a “remote” stream. This means, when you haven’t changed your remote streaming quality, you could end up streaming a 720p and most likely a transcode.

You can prevent that by telling Plex in the Plex server settings -> Network -> “LAN Networks” to consider an IP or IP address range to be considered a Local network.

I have three Plex instances running and only my main one is on host mode, the others are (and have to be) in bridge mode so that I can change the Port or else there would be a conflict because you can’t listen to the same port with two applications. But that also means that those other instances are constantly considered Remote unless I say they are local as described above.

Leave a Reply