0

I'm trying to create swarm consisting of 2 nodes, using docker-machine, it is easy to provision a VM and add it as a node, but I want to create a swarm using a ubuntu VM machine and Windows docker as manager without using docker-machine.

Running

docker swarm init

in Windows (Host Machine) gives me a token to add a worker. I have Ubuntu running in VirtualBox, Docker is also installed in the VM and I'm able to ssh into it and run commands but whenever I try to add this Ubuntu Machine as a worker node by using the token generated from Windows Machine, it says

Error response from daemon: Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.

I think it is related to port forwarding. I'm forwarding my VM port 22 to 127.0.0.1:22 in VBox for connecting via SSH. But I tried several combinations of forwarding. Still the VM is not able to join as a node in the swarm that I created in Windows.

Any guidance will be of great value.

Ajey
  • 9
  • 2

2 Answers2

0

Check if you have connectivity from your Ubuntu to your Windows machine. First, ssh to your Ubuntu and check:

  1. Windows is addressable, for example using ping windows-ip.

If it is not, make sure both are in the same network, for example setting a bridge network in your VM configuration.

  1. Windows is listening in ports needed by docker swarm:
  • TCP port 2376 for secure Docker client communication. This port is required for Docker Machine to work. Docker Machine is used to orchestrate Docker hosts.
  • TCP port 2377. This port is used for communication between the nodes of a Docker Swarm or cluster. It only needs to be opened on manager nodes.
  • TCP and UDP port 7946 for communication among nodes (container network discovery). UDP port 4789 for overlay network traffic (container ingress networking).

You can check this using telnet windows-ip port. If they are not reachable, check your Windows firewall.

I hope it helps!

Israel Varea
  • 2,600
  • 2
  • 17
  • 24
0

I tried to create a similar Swarm with a Windows manager node but never really got it to work. You can initialize a single-node Swarm from Windows with docker swarm init. However adding multiple worker nodes does not appear to be supported at the moment:
https://docs.docker.com/engine/swarm/swarm-tutorial/.
"Currently, you cannot use Docker Desktop for Mac or Docker Desktop for Windows alone to test a multi-node swarm".

The following options are possible:

  • Pure Linux swarm (Linux manager + Linux workers) which runs only Linux containers
  • Hybrid Swarm (Linux manager + Windows workers + Linux workers) which runs Windows and Linux containers
  • (Sometimes) Pure Windows Swarm using Win Server 2019 as the manager. The regular Windows updates have been known to break various features of Swarm. For example, https://github.com/moby/moby/issues/40998
    Then everyone either tries workarounds or waits for the next Windows update to fix the problem.

Personally I've had good luck with hybrid Swarm. It works fine with simple Ubuntu manager + standard Windows 10 workers. No need for Win Server.

jrbe228
  • 356
  • 3
  • 11