Docker Community Forums

Share and learn in the Docker community.

Not able to map to multiple adapters


(Sneh) #1

Hi I am a newbie to Docker so this may very well be a
Linux issue but from all I can say it seems to be an issue with docker.

Scenario:

I have a Linux host machine (running amazon Linux) which two I adapters each having a unique IP address, for example:

eth0- 172.31.28.168
eth1- 172.31.23.193

Without installing docker on this machine I can easily configure two
websites on this host, each listening on port 80 of an individual IP,
for example I can have Web1 listening on port 80 of 172.31.23.193 and
Web2 listening on port 80 of 172.31.28.168

Now I run one docker container for WEB1, and map its port 80 to port
80 of 172.31.23.193 on the host, works perfectly fine without any
issues.

I run another docker container for WEb2 and map its port 80 to port
80 of 172.31.28.168 on the host… and that does not work at all.

I know there are other options like using reverse proxy on the host
and all that stuff but this simple scenario of a container port being
able to map to a port on a dedicated IP address of the host should also
work…

Please let me know if it is not designed to work this way