1

I've got stack with some containers. One of them can't be reached by others by his hostname and it's seems to be an ip address problem.

docker network inspect mystack

"Name": "mystack_default",
        "Id": "k9tanhwcyv42473ehsehqhqp7",
        "Created": "2019-08-22T16:10:45.097992076+02:00",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.2.0/24",
                    "Gateway": "10.0.2.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "5d8e4b8cba8889036a869a280d5996f104f250677b8c962dc45ba72441e1840d": {
                "Name": "mystack_api.1.t4oax9f5uyw0237h2ysgwrzxq",
                "EndpointID": "34037c244f828e035c54b5ef3f21f020cf046218b39ffc2835dd4156f3d2b688",
                "MacAddress": "02:42:0a:00:02:23",
                "IPv4Address": "10.0.2.35/24",
                "IPv6Address": ""
            },
            "49f6a8444475fdcea2f96bdb7fbc62b908b5cd83175c3068a675761e64500e0e": {
                "Name": "mystack_webview.1.biby87oba9z3awkb3n4439yho",
                "EndpointID": "d9c0551a0213e38651c352970d5970b3f80b067676b3fb959845e139b7261c1a",
                "MacAddress": "02:42:0a:00:02:20",
                "IPv4Address": "10.0.2.32/24",
                "IPv6Address": ""
            },
        },
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4099"
        },
        "Labels": {
            "com.docker.stack.namespace": "mystack"
        },
        "Peers": [
            {
                "Name": "1b4f79e8e881",
                "IP": "192.168.1.67"
            }
        ]

api service can ping webview service using hostname but it's not the good ip of my webview service :

# ping webview
PING webview (10.0.2.17) 56(84) bytes of data. // NOT THE GOOD IP ! (it should be 10.0.2.32)
64 bytes from 10.0.2.17 (10.0.2.17): icmp_seq=1 ttl=64 time=0.126 ms 
64 bytes from 10.0.2.17 (10.0.2.17): icmp_seq=2 ttl=64 time=0.099 ms

webview can't ping api service using hostname (bad address error) but it works with ip address of my service :

/app # ping 10.0.2.35
PING 10.0.2.35 (10.0.2.35): 56 data bytes
64 bytes from 10.0.2.35: seq=0 ttl=64 time=0.331 ms
64 bytes from 10.0.2.35: seq=1 ttl=64 time=0.140 ms
^C
--- 10.0.2.35 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.140/0.235/0.331 ms
/app # ping api
ping: bad address 'api'

There is a problem with docker network but I don't know how to solve it. I already uninstall and reinstall docker, remove docker eth entries... Any idea ? Thank you very much for your help !

4

0 に答える 0