Service name does not get resolved on multi-physical-host swarm

Hello,

I am new to Docker. I have tried all I can imagine, but my multi-host Linux/Windows setup does not work. The problem:

I have two docker installations with Linux containers on two different physical machines on the same network - one running latest Ubuntu 18.04.2 LTS and another one running latest Windows 10 Pro Version 1809 (OS Build 17763.316)

Docker version on Ubuntu (latest):

Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        774a1f4
 Built:             Thu Feb 28 06:53:11 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       774a1f4
  Built:            Thu Feb 28 05:59:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Docker version on Windows 10 (latest):

Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:31 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 04:13:06 2019
  OS/Arch:          linux/amd64
  Experimental:     false

I create a swarm on the Ubuntu machine and join it from the Windows 10 machine. I use –advertise-addr with the physical IP addresses of the machines.

Then I run:

docker stack deploy --compose-file grid.xml grid

grid.xml contents:

version: "3.7"

networks:
  main:
    driver: overlay
   
services:
  hub:
    image: selenium/hub:latest
    ports:
      - "4444:4444"
    networks:
      - main
    deploy:
      placement:
        constraints:
          - node.role == manager
          
  chrome:
    image: selenium/node-chrome:latest
    networks:
      - main
    volumes:
    - /dev/shm:/dev/shm
    environment:
      HUB_HOST: hub
      HUB_PORT: 4444
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.role == worker
    entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh'

When I inspect docker logs on the manager/hub (Ubuntu), I see Selenium Grid hub is running as expected:

INFO [Hub.start] - Selenium Grid hub is up and running
INFO [Hub.start] - Nodes should register to http://172.18.0.3:4444/grid/register/
INFO [Hub.start] - Clients should connect to http://172.18.0.3:4444/wd/hub

When I inspect docker logs on the worker/node (Windows 10), there is a problem with the registration of the node to the hub, because “hub” does not get resolved:

INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555
INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub
INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
WARN [SelfRegisteringRemote.registerToHub] - Error getting the parameters from the hub. The node may end up with wrong timeouts.hub: Name or service not known
INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://hub:4444/grid/register
INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: Error sending the registration request: hub
INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: The hub is down or not responding: hub
INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: The hub is down or not responding: hub: Name or service not known

My question is - is such a setup possible? If yes, what can be the problem?

I have disabled all Antivirus/Firewall software.

A strange thing to me is that both machines listen on TCP port 2377 and TCP/UDP port 7946 but only Ubuntu listens on UDP port 4789.

Thank you very much.