for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Stack Service Containers Can't Communicate Across Nodes

Open Vacant0mens opened this issue 8 years ago • 89 comments

Expected behavior

Services in the same Stack/overlay network should be able to talk to each other.

Actual behavior

Only replicas that are hosted on the same node can talk to each other.

Information

Windows Server 2016, 1709 build, latest updates (not Insider Preview)

output of docker version:

Client:
 Version:      17.06.2-ee-6
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   e75fdb8
 Built:        Mon Nov 27 22:46:09 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.06.2-ee-6
 API version:  1.30 (minimum version 1.24)
 Go version:   go1.8.3
 Git commit:   e75fdb8
 Built:        Mon Nov 27 22:55:16 2017
 OS/Arch:      windows/amd64
 Experimental: false

netstat -ano shows that port 4789/udp is not open or listening (it doesn't come up in the list at all).

Based on this issue in docker/swarm, it doesn't seem to be a windows-only problem.

Steps to reproduce the behavior

  1. Deploy stack with two or more services
  2. docker exec into one of the started containers
  3. ping another service via dnsrr, or by IP address.

Vacant0mens avatar Jan 02 '18 21:01 Vacant0mens

ping @jasonbivins

Vacant0mens avatar Feb 12 '18 21:02 Vacant0mens

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar May 14 '18 08:05 docker-robott

We have seen this same issue with Win Srv 2016, version 1709 and even with latest 1803 version. Docker version 17.06.2-ee-10 or 18.03.1-ce does not make difference.

We also found that on Linux + Windows hybrid swarm:

  • connections from Linux to Windows works
  • connections from Windows to service VIP which is running either on Linux node or another Windows node fails.
  • connections from Windows to any container real IP (not VIP) works.

I can also see that Linux nodes are listening VXLAN port 4789/udp but Windows nodes are not.

@thaJeztah I know that you are syncing items between github projects so do you know if there is another item open of this issue?

It would be also nice to hear if @StefanScherer have seen this issue? (I know that he is one of the pioneers as using Linux + Windows hybrid swarm).

olljanat avatar May 14 '18 17:05 olljanat

@kallie-b ping this is most probably issue on Windows overlay implementation.

olljanat avatar May 16 '18 21:05 olljanat

@daschott @jmesser

(I've actually moved off of this project, unfortunately! But David or Jason should be able to help out).

kallie-b avatar May 16 '18 22:05 kallie-b

Ok. Thanks anyway for connecting this issue to rights people.

I can also tell that I just tested to create new Docker Swarm where I have Ubuntu 16.04 as manager and Windows Server, version 1803 as worker and both of them are running same 17.06.2-ee-10 version of docker.

Then I created test services using these commands

docker network create --driver overlay test
docker service create --name linux --network test --constraint node.platform.os==linux nginx
docker service create --name win --network test --constraint node.platform.os==windows microsoft/iis:nanoserver

And here you can see that ping from container on Linux to container on Windows works:

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES
ea7e22a00d84        nginx:latest        "nginx -g 'daemon ..."   About a minute ago   Up About a minute   80/tcp              linux.1.583ua7658uxz8msc7l3uiof5w

$ docker exec ea7e22a00d84 ping -c 4 win
PING win (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4 (10.0.0.4): icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from 10.0.0.4 (10.0.0.4): icmp_seq=2 ttl=64 time=0.047 ms
64 bytes from 10.0.0.4 (10.0.0.4): icmp_seq=3 ttl=64 time=0.048 ms
64 bytes from 10.0.0.4 (10.0.0.4): icmp_seq=4 ttl=64 time=0.068 ms

--- win ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2997ms
rtt min/avg/max/mdev = 0.037/0.050/0.068/0.011 ms

but ping from container on Windows to container on Linux fails:

C:\>docker ps
CONTAINER ID        IMAGE                      COMMAND                   CREATED             STATUS              PORTS               NAMES
b531d3fd223b        microsoft/iis:nanoserver   "C:\\ServiceMonitor..."   2 minutes ago       Up 2 minutes        80/tcp              win.1.nc0hvqtzgrs3bpkpkqeohw65y

C:\>docker exec b531d3fd223b ping linux

Pinging linux [10.0.0.2] with 32 bytes of data:
Reply from 10.0.0.5: Destination host unreachable.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 1, Lost = 3 (75% loss),

olljanat avatar May 16 '18 23:05 olljanat

@Vacant0mens FYI. I found workaround to this issue. Even it have said on this blog post that routing mesh is supported on Windows Server, version 1709 and above you still must use DNS routing endpoint mode for all services ( --endpoint-mode dnsrr ) where you want connect from Windows containers.

So fixed version of my commands above are:

docker network create --driver overlay test
docker service create --name linux --network test --endpoint-mode dnsrr --constraint node.platform.os==linux nginx
docker service create --name win --network test --endpoint-mode dnsrr --constraint node.platform.os==windows microsoft/iis:nanoserver

Very good documentation about this stuff is available on here: https://sreeninet.wordpress.com/2016/07/29/service-discovery-and-load-balancing-internals-in-docker-1-12/

olljanat avatar May 18 '18 13:05 olljanat

@olljanat, I'm not sure how different it is, but I was doing something that looks very similar with a Stack and a Compose file, except that I was using only Windows. That's where this problem came up. I made my own Nginx image for Windows and it was unable to communicate to the other services running on the other hosts in the swarm. It could connect to services where the containers ran on the same host, but not the others. I would try pinging your Linux service/container from the iis container and see what happens.

Vacant0mens avatar May 18 '18 14:05 Vacant0mens

@Vacant0mens for me it sounds like same problem. I tested some point add multiple Windows nodes to swarm and services running on them was not able to communicate with services on other nodes.

And just FYI, I actually spent whole this week with this issue because it is very critical for our production use cases and tested multiple combinations of versions, configs, etc and this settings was only one which had any effect to this one.

olljanat avatar May 18 '18 18:05 olljanat

/cc @carlfischer1 @johnstep

thaJeztah avatar May 20 '18 08:05 thaJeztah

Note: I am now seeing this issue on a single node swarm, windows 2016 server, docker EE

scmikes avatar Jun 04 '18 13:06 scmikes

@scmikes that is interesting. Did you try if endpoint_mode workaround above helps?

olljanat avatar Jun 04 '18 15:06 olljanat

Same failr with end_point mode

very simple yml file, contributed by some else who verified at their site



version: '3.3'

networks:
  my-net:
    driver: overlay
    attachable: true
           
services:
 
  app1:
    image:  hello-world
    networks:
      - my-net
    deploy:
      endpoint_mode: dnsrr 
    command: powershell -command Start-Sleep 86400
  app2:
    image:  hello-world
    networks:
      - my-net
    deploy:
      endpoint_mode: dnsrr 
    command: powershell -command Start-Sleep 86400  

  1. save yml as docker-compose.yml
  2. docker swarm init ...
  3. docker stack deploy -c docker-compose.yml simple
  4. docker ps to get continer name
  5. docker exec -it powershell
  6. ping other service

PS C:\> ping simple_app2
Ping request could not find host simple_app2. Please check the name and try again.
PS C:\> ping simple_app1
Ping request could not find host simple_app1. Please check the name and try again.

Note: same results with or without deploy : end_point tag

Verified on

windows 10, build 1803, docker stable and edge windows 2016, windows ee

scmikes avatar Jun 04 '18 19:06 scmikes

@scmikes I can confirm that this issue happens also on my Win 10, buid 1803 with docker-ce stable.

and looks that it is not just stack issue but same thing happens if I manually create services for these

docker network create --driver overlay my-net
docker service create --name app1 --network my-net --endpoint-mode dnsrr hello-world powershell -command Start-Sleep 86400
docker service create --name app2 --network my-net --endpoint-mode dnsrr hello-world powershell -command Start-Sleep 86400

So to that issue we don't even have workaround (or maybe workaround would be to have two Windows machines on swarm, locate these services to different nodes and use --endpoint-mode dnsrr but I have not tested that).

olljanat avatar Jun 04 '18 21:06 olljanat

@olljanat Thank you for verifying this. You are the 3/3 that have verified this.

We are working to support windows containers as well as Linux. Our Linux containers have been fine for quite some time.

Doesn't this issue indicate that swarm mode, with multiple services per node are non-functional on windows?

Thank you very much, Michael

scmikes avatar Jun 04 '18 21:06 scmikes

Yes, that confirms that there cannot be multiple services per node which need to be able to communicate with each others.

@scmikes if you are planning to run Windows containers with swarm mode on production you probably want to look my issue tracking repository

olljanat avatar Jun 04 '18 22:06 olljanat

@olljanat I have seen many of the problems in your issue tracking show up in Windows-only swarms, some even with the 1709 build. Will there be a new version of Docker EE for Windows any time soon? It seems to be neglected in lieu of all the Docker EE 2.0 hype. Originally it was stated that EE would get updates every 3 months, but we're coming up on a year now without any significant updates. Is 18.03, or 18.06 coming any time soon? My team has had to resort to other means of running our new applications because we couldn't get Docker in Windows working stable enough to even properly test in our Dev environment.

Vacant0mens avatar Jun 04 '18 22:06 Vacant0mens

@olljanat, Thanks for the link and the info. This bug was such a showstopper for us that we were not able to procced with our linux->windows containers port. We are hoping to offer our customers both linux and windows containers.

Thanks again,
Michael Schneider

scmikes avatar Jun 05 '18 12:06 scmikes

@Vacant0mens, notice that Windows Server, version 1803 was published to MSDN/volume licensing site on 7th of May. You definitely should use that instead of old 1709 build as it contains plenty of improvements to performance, etc. Looks that they are also frozen Docker EE features to 17.06 level but still backporting fixes to it quite often ( https://docs.docker.com/ee/engine/release-notes/ ) which is probably even better than do big feature updates as there is plenty of stability issues especially with Windows containers.

Docker EE 2.0 hype comes most probably from UCP which is good tool but quite expensive.

We have been running Windows containers on 2016 over year now on our dev/test environments and they works fine on single server setup but it looks that swarm mode and especially overlay network is which causes issues.

@Vacant0mens / @scmikes if this is critical issue for you and you have possibility then consider to create case to Microsoft Premier Support: https://success.docker.com/article/where-to-get-help-with-windows We are able to connect from Linux to Windows and Windows to Linux now with that --endpoint-mode dnsrr workaround so we probably will no do that.

olljanat avatar Jun 05 '18 13:06 olljanat

Actually it looks that Docker EE on Windows Server, version 1803 works correctly.

I just deployed this stack to swarm where I have Ubuntu 16.04 as manager and Windows Server, version 1803 as worker. Both of them are running docker version 17.06.2-ee-13. And connections between all the containers works just fine :)

version: '3.3'

networks:
  test:
    driver: overlay

services:
  win1:
    image: microsoft/nanoserver:1803_KB4103721
    networks:
      - test
    deploy:
      endpoint_mode: dnsrr
      placement:
        constraints:
          - node.platform.os==windows
    command: ping -t 127.0.0.1
  win2:
    image: microsoft/nanoserver:1803_KB4103721
    networks:
      - test
    deploy:
      endpoint_mode: dnsrr
      placement:
        constraints:
          - node.platform.os==windows
    command: ping -t 127.0.0.1
  linux1:
    image: alpine:3.7
    networks:
      - test
    deploy:
      endpoint_mode: dnsrr
      placement:
        constraints:
          - node.platform.os==linux
    command: sh -c "ping 127.0.0.1"
  linux2:
    image: alpine:3.7
    networks:
      - test
    deploy:
      endpoint_mode: dnsrr
      placement:
        constraints:
          - node.platform.os==linux
    command: sh -c "ping 127.0.0.1"

So probably it is actually just Windows 10 or docker ce where even that endpoint_mode=dnsrr setting does not fix connectivity issues.

olljanat avatar Jun 07 '18 17:06 olljanat