Not able to connect docker from host when network

2019-06-08 23:12发布

问题:

I am not able to connect to docker container when there is network/ip change from office to home. But the same works with localhost or 127.0.0.1

I am connecting to VPN to connect to database.

root@1c970ed5cd64:/etc# curl
http://localhost:8090/admin/health_check/all
{“health”:“passed”}root@1c970ed5cd64:/etc# curl
http://192.168.0.103:8090/admin/health_check/all curl: (7) Failed to
connect to 192.168.0.103 port 8090: Connection refused

When i install docker again everything works fine.

I have created docker-machine with external virtual switch pointing to wifi and ran the container with the host ip.

The same working on diffferent machine. Below i have not seen DOCKER_HOST ip when i do inspect the network

     PS C:\Users\KH1046> docker network inspect -v 6fad6cc07d43 [
{
    "Name": "bridge",
    "Id": "6fad6cc07d43f576ca4921559346a4919ea6ffd8172726adccb31b4ffaa23acd",
    "Created": "2017-08-12T18:07:33.2239814Z",
    "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,
    "Attachable": false,
    "Ingress": false,
    "ConfigFrom": {
        "Network": ""
    },
    "ConfigOnly": false,
    "Containers": {
        "b81f7e258650a150c72ab255c35d321a9a01aea090c6e03ec38de6c373ebfe46": {
            "Name": "konymobilefabric_tomcat",
            "EndpointID": "ae18e2a9874ab56967d06450ea7b26c7f47c408ff173c1610ac7bd0b322e24d3",
            "MacAddress": "02:42:ac:11:00:02",
            "IPv4Address": "172.17.0.2/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": {}
} ]

Thanks, Kusuma