2

I'm currenlty trying to connect/join a Linux Docker Swarm cluster with my Windows machine in order to test a stack without sending the stack over and over to my test cluster under Linux. My problem is that I can't join the cluster with my Windows Docker.

My cluster had initially 1 manager and 4 workers. I recently created and added a new manager to it in order to add my Windows Docker node as manager. With this, I shouldn't have any issue with the manager quorum (since my two managers will be always up, and my Windows Docker could be interrupted at any time).

I configured my local firewall - and also on each nodes of my Linux cluster - to accept connections on ports (the following can be found at the end of this documentation) :

  • TCP port 2377 for cluster management communications
  • TCP and UDP port 7946 for communication among nodes
  • UDP port 4789 for overlay network traffic

The advertising network in my cluster is 192.168.0.0/24, one of my manager's IP address is 192.168.0.100 and my PC's IP address is 192.168.0.143 (same network). They can ping each others and I tested the ports defined before.

So, when I perform the docker swarm join-token manager on a manager I have something like this:

docker swarm join --token SWMTKN-1-27hzpcnek5... 192.168.0.200:2377

If I copy/paste it to my PC:

Error response from daemon: manager stopped: can't initialize raft node: rpc error: code = Unknown desc = could not connect to prospective new cluster member using its advertised address: rpc error: code = DeadlineExceeded desc = context deadline exceeded

But, even with this error, on my cluster, if I run docker node ls, my node appears in the list:

8380zb5jeke0elwohr7aieke8     linuxkit-00155d00d946   Ready               Active

But on my PC Docker thinks that it's not member of a cluster:

Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

The Docker version is different in the cluster and on my PC:

  • Cluster:
    • Client: 17.09.1-ce
    • Server: 17.09.1-ce
  • PC:
    • Client: 18.03.1-ce
    • Server: 18.03.1-ce

Could the issue came from this?

N.B.: I work with Bash on Ubuntu on Windows, but the result is the same on PowerShell.

N.B. 2: I don't know if it's useful, but since Docker for Windows uses Hyper-V, I have a NAT interface: 10.0.75.0/24 (and the VM's IP address is 10.0.75.1). I tried to use this interface as advertising address and listening address but the issue returned is the same

Does anybody already encounter this issue? Any ideas?

Thanks! :)

EDIT 1:

Disaggreeing with @BMitch's answer, after tests, I don't think there is any issue with the difference between managers' Docker versions.

As I said in my previous comment on BMitch's answer, I had to add the option --advertise-addr 192.168.0.200 - which is my leader manager address - to the docker join command. Until this, I used --advertise-addr 192.168.0.143, my PC address.

I hope it will help others.

EDIT 2:

If I run docker info on my PC I got this:

Swarm: active
 NodeID: o9wehjcyhe3n6xxzy1epnhxdp
 Error: rpc error: code = Unknown desc = The swarm does not have a leader. It's possible that too few managers are online. Make sure more than half of the managers are online.
 Is Manager: true
 Node Address: 192.168.0.200
 Manager Addresses:
  192.168.0.200:2377
  192.168.0.200:2377
  192.168.0.201:2377

There are two managers with address 192.168.0.200:2377.

EDIT 3:

I finally gave up and installed a Linux server on another machine in order to join the cluster. That's not what I wanted but I can work now.

If any have information about this issue, I invite you to share it. Thanks :)

1

2 Answers 2

2

Why do you want to create a new Manager node, risking damaging your raft consensus and cie?

I find it way easier to simply expose the docker socket locally, as if you were working inside the node, but with your Windows environment.

To do so, simply open a ssh tunnel that exposes /var/run/docker.sock:

 ssh -M -S ~/.docker.sock \
     -fnNT -4 -L localhost:1337:/var/run/docker.sock \
     USER@MANAGER_IP

Refer to man ssh to see what all these options mean.

It will open an ssh tunnel; you will still be in your local environment shell, only thing left to do is set the proper DOCKER_HOST environment var, so your docker cli is bound to your swarm manager.

export DOCKER_HOST=localhost:1337

And that's it.

Note: Docker also includes an option to do this; I've quickly searched for it but can't manage to find it. It's in the most recent version of docker.

0

You cannot mix docker engine versions on the swarm managers. They need to each be running the same version, particularly when adding, removing, promoting, and demoting nodes. When you need to upgrade the engine on the managers, you can upgrade the engines in place, without promote/demote, but I would strive to minimize the time in this state and avoid using any newer features in the swarm.

Adding a second manager to a cluster is also not recommended. Should any issue occur, like the problem you're currently experiencing, you will lose quorum with only a single manager running. In effect, you've doubled the potential points of failure rather than creating an HA infrastructure. With quorum, you do need at least 3 nodes to be managers to have the ability to lose a single node. It's best to do this to an existing cluster by adding the additional managers first as workers, and then after you verify connectivity, promoting those nodes to managers.

2
  • Ok, thanks, I'll try to use the same version tomorrow and tell you if it does solve the problem! Thanks anyway for your answer. And I'll have 3 managers if it succeeds, 2 if it won't (so the quorum will be available). Remember that is a test cluster, for preproduction for more details, not for production. Production will have 3 real managers. That's why I allowed myself to do this "trick".
    – Paul Rey
    Commented May 24, 2018 at 20:21
  • Well, I set the same version on all my nodes. I achieved to join the cluster but I don't think that is for this reason..! I mean, I already had a manager with a different version and it worked all the way. Additionnaly, I cannot achieve to join the swarm until I set the option --advertise-addr 192.168.0.200 - which is my leader manager address - to the docker join command. I feel dumb but, anyway, it seems to work... Thanks for you help @BMitch!
    – Paul Rey
    Commented May 25, 2018 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.