maxpovver
maxpovver

Reputation: 1600

Connecting to containers IP address is impossible in Docker for Windows

This issue happens when you install latest Docker for Windows that uses Hyper-V.

However you can see ips in docker network inspect bridge output:

"Containers": {
            "...": {
                "Name": "dockerdevenvironment_rabbit_1",
                "EndpointID": "...",
                "MacAddress": "02:42:ac:11:00:04",
                "IPv4Address": "172.17.0.4/16",
                "IPv6Address": ""
            },
            "...": {
                "Name": "webserver",
                "EndpointID": "...",
                "MacAddress": "02:42:ac:11:00:02",
                "IPv4Address": "172.17.0.2/16",
                "IPv6Address": ""
            },
            "...": {
                "Name": "dockerdevenvironment_mongo_1",
                "EndpointID": "...",
                "MacAddress": "02:42:ac:11:00:05",
                "IPv4Address": "172.17.0.5/16",
                "IPv6Address": ""
            }

You can't even ping them or connect them in any way.

Upvotes: 3

Views: 3166

Answers (1)

maxpovver
maxpovver

Reputation: 1600

By default dockerNAT assigns 10.0.75.0/24 to MobyLinuxVM. Docker inside MobyLinuxVM assigns to containers IP addresses in range 172.17.0.0/16. You have to alter route tables to access containers IP address:

route add 172.17.0.0 MASK 255.255.0.0 10.0.75.2 -p

source: https://forums.docker.com/t/connecting-to-containers-ip-address/18817

Upvotes: 6

Related Questions