Windows容器无法在Swarm中ping Ubuntu容器

我们正在尝试创build一个docker swarm,该docker swarm具有在Docker容器上运行的ASP.NET Docker服务,该容器通过运行在Ubuntu docker-machine上的Nginx服务提供服务。 问题是Windows容器没有正确响应群中的其他服务。 我们有Django应用程序使用相同的Nginx服务运行良好,但ASP.NET应用程序超时。我们进入Nginx容器,并成功地触及ASP.NET容器,但当我们进入ASP.NET容器请求正在发送到正确的IP但所有请求超时。

这里是我们所知道的这一点:

  1. Docker版本17.04.0-ce,构build4845c56
  2. 运行Windows Server 2016 – KB3150513
  3. 禁用防火墙来确认它不是端口的问题
  4. Windows容器在Docker实例上直接在Windows Server上运行
  5. Ubuntu容器在Ubuntu Docker机器上

我们的堆栈:

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS jhqjiqg9dhsw ourStack_DjangoProd.1 ourRepo/Django-prod:rc ourStack-worker-5 Running Running 38 seconds ago qixjelib9bzj ourStack_nginx.1 ourRepo/stealth-nginx:latest ourStack-worker-5 Running Running 34 seconds ago k8u0p6mzwz54 ourStack_DjangoStage.1 ourRepo/Django-staging:latest ourStack-worker-5 Running Running 39 seconds ago v1tzi1z7hxei ourStack_DjangoDev.1 ourRepo/Django-staging:latest manager-3 Running Running 39 seconds ago uxlvdlp6qwuu ourStack_asp-app.1 ourRepo/asp-app:latest CAMSTAT-SVR Running Running less than a second ago omvwb4cjdrzd ourStack_nginx.2 ourRepo/stealth-nginx:latest manager-3 Running Running 33 seconds ago kc8tp6dpf6i1 ourStack_DjangoProd.2 ourRepo/Django-prod:rc manager-3 Running Running 37 seconds ago 

Nginx的ifconfig:

 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1450 inet 10.255.0.13 netmask 255.255.0.0 broadcast 0.0.0.0 ether 02:42:0a:ff:00:0d txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.18.0.5 netmask 255.255.0.0 broadcast 0.0.0.0 ether 02:42:ac:12:00:05 txqueuelen 0 (Ethernet) RX packets 229 bytes 263967 (257.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 107 bytes 7219 (7.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1450 inet 10.0.0.6 netmask 255.255.255.0 broadcast 0.0.0.0 ether 02:42:0a:00:00:06 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1 (Local Loopback) RX packets 12 bytes 1456 (1.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12 bytes 1456 (1.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

Nginx的平台ASP:

 root@f4dde99e6401:/var/www# ping ourStack_asp-app PING ourStack_asp-app (10.0.0.2): 56 data bytes 64 bytes from 10.0.0.2: icmp_seq=0 ttl=64 time=0.401 ms 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.095 ms 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.090 ms 64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.105 ms 64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=0.104 ms 64 bytes from 10.0.0.2: icmp_seq=5 ttl=64 time=0.097 ms 64 bytes from 10.0.0.2: icmp_seq=6 ttl=64 time=0.092 ms 64 bytes from 10.0.0.2: icmp_seq=7 ttl=64 time=0.094 ms 64 bytes from 10.0.0.2: icmp_seq=8 ttl=64 time=0.099 ms 64 bytes from 10.0.0.2: icmp_seq=9 ttl=64 time=0.095 ms --- ourStack_asp-app ping statistics --- 10 packets tranDjangotted, 10 packets received, 0% packet loss round-trip min/avg/max/stddev = 0.090/0.127/0.401/0.091 ms 

Nginx服务检查:

 [ { "ID": "ualbse6gr74jehk66ec9ftekk", "Version": { "Index": 5388 }, "CreatedAt": "2017-05-02T13:24:12.436333625Z", "UpdatedAt": "2017-05-02T13:24:12.442605083Z", "Spec": { "Name": "ourStack_nginx", "Labels": { "com.docker.stack.namespace": "python" }, "TaskTemplate": { "ContainerSpec": { "Image": "8675309/stealth-nginx:latest@sha256:ce9c2faab917ad2fe626843e96846eacb98dc8feb5fcd930ebe1d4da77bf0681", "Labels": { "com.docker.stack.namespace": "python" } }, "Resources": {}, "RestartPolicy": { "Condition": "on-failure", "MaxAttempts": 0 }, "Placement": { "Constraints": [ "node.platform.os == linux" ] }, "ForceUpdate": 0 }, "Mode": { "Replicated": { "Replicas": 2 } }, "UpdateConfig": { "Parallelism": 2, "Delay": 10000000000, "FailureAction": "pause", "MaxFailureRatio": 0 }, "Networks": [ { "Target": "8mcvr2tcfgeacn16gulkkzkpb", "Aliases": [ "nginx" ] } ], "EndpointSpec": { "Mode": "vip", "Ports": [ { "Protocol": "tcp", "TargetPort": 80, "PublishedPort": 80, "PublishMode": "ingress" } ] } }, "Endpoint": { "Spec": { "Mode": "vip", "Ports": [ { "Protocol": "tcp", "TargetPort": 80, "PublishedPort": 80, "PublishMode": "ingress" } ] }, "Ports": [ { "Protocol": "tcp", "TargetPort": 80, "PublishedPort": 80, "PublishMode": "ingress" } ], "VirtualIPs": [ { "NetworkID": "fbopakq2nzt436rq1b2zv5ol7", "Addr": "10.255.0.10/16" }, { "NetworkID": "8mcvr2tcfgeacn16gulkkzkpb", "Addr": "10.0.0.4/24" } ] } } ] 

ASP服务:

 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e986dfb90c79 ourRepo/asp-app@sha256:1580d526c06482d7ef92c1fdec4beb494ff340feb6f9ec7125fdf67ffa7eefab "C:\\ServiceMonitor..." 6 minutes ago Up 6 minutes 80/tcp, 6000/tcp ourStack_asp-app.1.uxlvdlp6qwuu837kutibvhnac 

ASP ipconfig:

 Windows IP Configuration Ethernet adapter vEthernet (Container NIC 67208761): Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::f9c8:5b32:1e75:d7bb%64 IPv4 Address. . . . . . . . . . . : 10.255.0.6 Subnet Mask . . . . . . . . . . . : 255.255.0.0 Default Gateway . . . . . . . . . : Ethernet adapter vEthernet (Container NIC 6546affc): Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::d53e:9d30:758a:29ee%69 IPv4 Address. . . . . . . . . . . : 10.0.0.3 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : Ethernet adapter vEthernet (Container NIC 5e1156e0): Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::d000:c63d:ff:b91a%74 IPv4 Address. . . . . . . . . . . : 172.17.227.52 -- Can access .NET app from here at port 6000 Subnet Mask . . . . . . . . . . . : 255.255.240.0 Default Gateway . . . . . . . . . : 172.17.224.1 

ASP平台:

 ping ourStack_nginx Pinging ourStack_nginx [10.0.0.4] with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 10.0.0.4: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), 

ASP服务检查:

 [ { "ID": "kojjy62r48slhipzvyti56ewb", "Version": { "Index": 5381 }, "CreatedAt": "2017-05-02T13:24:11.78049809Z", "UpdatedAt": "2017-05-02T13:24:11.782822174Z", "Spec": { "Name": "ourStack_asp-app", "Labels": { "com.docker.stack.namespace": "ourStack" }, "TaskTemplate": { "ContainerSpec": { "Image": "ourRepo/asp-app:latest@sha256:1580d526c06482d7ef92c1fdec4beb494ff340feb6f9ec7125fdf67ffa7eefab", "Labels": { "com.docker.stack.namespace": "ourStack" } }, "Resources": {}, "Placement": { "Constraints": [ "node.platform.os == windows" ] }, "ForceUpdate": 0 }, "Mode": { "Replicated": { "Replicas": 1 } }, "Networks": [ { "Target": "8mcvr2tcfgeacn16gulkkzkpb", "Aliases": [ "asp-app" ] } ], "EndpointSpec": { "Mode": "vip", "Ports": [ { "Protocol": "tcp", "TargetPort": 6000, "PublishedPort": 6000, "PublishMode": "ingress" } ] } }, "Endpoint": { "Spec": { "Mode": "vip", "Ports": [ { "Protocol": "tcp", "TargetPort": 6000, "PublishedPort": 6000, "PublishMode": "ingress" } ] }, "Ports": [ { "Protocol": "tcp", "TargetPort": 6000, "PublishedPort": 6000, "PublishMode": "ingress" } ], "VirtualIPs": [ { "NetworkID": "fbopakq2nzt436rq1b2zv5ol7", "Addr": "10.255.0.3/16" }, { "NetworkID": "8mcvr2tcfgeacn16gulkkzkpb", "Addr": "10.0.0.2/24" } ] } } ]