Docker container having multiple ips

Docker has been assigned two ips during creation time and application is running inside this container listening to ip1:port1 and ip2:port2.These port mappings are published for the container for commumnication to the external network.But at a time only one ip:port from two is reachable outside the container.Can any one help me in resolving this issue.

Can you give the commands that you used to start container by which you are exposing 2 IPs and ports? what network driver are you using?

  1. Commands used is :-

a. docker run -it --network network1 -p 5060:5060/udp -p 10.64.217.120:8080:8080 myproject bash

b. docker network connect bridge e389ed8034d9

  1. Output of command “docker network ls” :-
    NETWORK ID NAME DRIVER SCOPE
    cea02281f53a bridge bridge local
    cfc04b1e42ba host host local
    5f03b29dd9e2 none null local
    78c75db1da95 network1 bridge local

  2. Output of command “docker network inspect bridge”:-

[
{
“Name”: “bridge”,
“Id”: “cea02281f53a5446975a412fff149909246f1aedb74caee00bfa5056a8885439”,
“Scope”: “local”,
“Driver”: “bridge”,
“EnableIPv6”: false,
“IPAM”: {
“Driver”: “default”,
“Options”: null,
“Config”: [
{
“Subnet”: “172.17.0.0/16”,
“Gateway”: “172.17.0.1”
}
]
},
“Internal”: false,
“Containers”: {
“0979f61bfaa51c1bb4c4bedbc5bfdd711a6b10289b98701666da47871b915f78”: {
“Name”: “prickly_swirles”,
“EndpointID”: “f7396252438ee2496b0de77d47988bee31fee9a53cdafd880d268cfd73e3517b”,
“MacAddress”: “02:42:ac:11:00:02”,
“IPv4Address”: “172.17.0.2/16”,
“IPv6Address”: “”
},
“1f544380d2d10b68a5cd3d8018e4374d82a0658f8ea509482122e4903ec0cc1a”: {
“Name”: “registry”,
“EndpointID”: “f8a931de2b526f1569be11c3210e1871f199c276a1b729ea6ebed07a4fd11b38”,
“MacAddress”: “02:42:ac:11:00:05”,
“IPv4Address”: “172.17.0.5/16”,
“IPv6Address”: “”
},
“2b3cfa59ded1de0d5041922ba336761e1d774bcac156f8550fb193ab70101525”: {
“Name”: “reverent_perlman”,
“EndpointID”: “c16a7b1034e08d151584f2695aec477d531fea75706c056f6c610b29022f794a”,
“MacAddress”: “02:42:ac:11:00:03”,
“IPv4Address”: “172.17.0.3/16”,
“IPv6Address”: “”
}
},
“Options”: {
“com.docker.network.bridge.default_bridge”: “true”,
“com.docker.network.bridge.enable_icc”: “true”,
“com.docker.network.bridge.enable_ip_masquerade”: “true”,
“com.docker.network.bridge.host_binding_ipv4”: “0.0.0.0”,
com.docker.network.bridge.name”: “docker0”,
“com.docker.network.driver.mtu”: “1500”
},
“Labels”: {}
}
]

This is what I understand from your output:
container is connected to “network1” and "bridge"
Following ports are mapped from container to host: -p 5060:5060/udp -p 10.64.217.120:8080:8080

its not clear why container e389ed8034d9 is not listed in your “docker network inspect bridge” output.
What is the intention to connect container to both bridge and network1? are you trying to selectively expose services to either networks?
what are the 2 ip/port that you are trying to access and having issues? are they localhost:5060 and 10.64.217.120:8080?

The container has two IPs, one assigned to eth0 and one to eth1. There are two services running. One is listening on port 5060 of IP1 and one on 8080 of IP2. IP1:5060 is reachable from outside the container whereas IP2:8080 is not reachable from outside. While specifying the port mapping, is there a way to specify the container IP and port to bind to the Host IP and port? As I am not able to specify the container IP during port mapping, docker is redirecting the traffic intended for IP2:8080 to IP1:8080. How can I make IP2:8080 reachable from outside.

The services that runs in container typically runs on all the IPs in container and thats why its not needed to mention the container IP when we do the host mapping. How did you start the service inside container in specific IP?