Docker Community Forums

Share and learn in the Docker community.

When add one more network on ubuntu container, container not reachable on host ip and public port

docker

(Priyadarshini) #1

If I created a network and use same for container. My ubuntu container is running two web applications and accessible outside using hostip:publicPort.

docker run -it -P --name=server1 --net=bridge1 vim-http:1.0 root@48a6253810a2:/opt/app#./START Listening on
http://172.19.0.4:8082/ Hit Ctrl-C to quit.

docker port server1

22/tcp -> 0.0.0.0:32832 80/tcp -> 0.0.0.0:32831 8082/tcp -> 0.0.0.0:32830
container has ip 172.19.0.4 host ip is 10.213.13.13

I can work on app outside network using 10.213.13.13:32830 and http using 10.213.13.13:32831.

If I add one more network on same ubuntu container, not able to access application using same hostip:publicPort.

docker network connect bridge2 server1

Now container has one more ip 172.18.0.4

I can NOT work on app outside network using 10.213.13.13:32830 and http using 10.213.13.13:32831.

I want my one web application should listen on bridge1 and other should listen on bridge2. When I configure my application for that, I can run inside host using container ips but none of them accessible outside using 10.213.13.13:32830 and http using 10.213.13.13:32831.

Dokcer port and netsat -tupln does not show any problem.

docker port server1
22/tcp -> 0.0.0.0:32832
80/tcp -> 0.0.0.0:32831
8082/tcp -> 0.0.0.0:32830
Please help how to make container networking working when we use two networks at same time.