Docker Community Forums

Share and learn in the Docker community.

Individual external/public IP per container on same host


(Hotchip) #1

Hello everybody,

I am trying to host 2 docker containers on the same physical host. After all, this is what Docker is about. But both containers contain a webserver application, and it is a requirement for me to have the standard ports 80 HTTP and 443 HTTPS available on the standard port number for BOTH hosts. This can not be acheived with a single IP address, otherwise one of the two hosts would require to have it ports re-routed, such as 80 to 8080 and 443 to 8443.

The usual networking solution for this is to have 2 public IPs aliased on the same ethernet adapter, and to run each webserver or container on its own IP address. This should be trivial, but after having read a lot of docker tutorials and forums, I can see several people asking this question which never gets answered properly. This is quite amazing.

So, assuming one already has 2 public IP addresses available and aliased on eth0, is Docker capable or unable to run 2 or more containers each having is own PUBLIC IP address (not local, not NATed or bridged on a single public ip address), and if it can, does anyone know how it could be done ?

Thank you