getting docker swarm cluster worker node error - docker

I'm working on docker swarm. When I connect to a worker node I get this error:
Error response from daemon: rpc error: code = 14 desc = grpc: the
connection is unavailable
I have already stopped firewall and setenforce 0. What could be the problem?

If you are using VM then you can init docker swarm with alternative IP Address using docker "swarm init --advertise-addr :"
Example: docker swarm init --advertise-addr 192.168.99.100:2377
and then add the nodes to the swarm.
Example: docker swarm join --token --advertise-addr :
docker swarm join --token SWMTKN-1-RANDOMTOKEN 192.168.99.100:2377
Some people say that it works only with 2377 port.
Check yourself if it works for you as well.

If you are using the swarm init --advertise-addr <some ip>.Then you will get the join token but when I am going to add new swarm to the manager as a worker then i am getting the same error node is already part of swarm.
So take care while using vm ip address. It should be different from and exact match to the manager ip.

Related

Getting error when try to add docker swarm manager into multipass VM

I have tried to launch two multipass VM. After installing docker in the multipass, I am trying to initialize docker swarm in one of the multipass vm. The command is:
multipass exec node1 -- /bin/bash -c 'docker swarm init --advertise-addr 10.173.198.201:2377 --listen-addr 10.173.198.201:2377'
But then the error comes up. It says:
Error response from daemon: advertise address must be a non-zero IP address or network interface (with optional port number)
Now how can I solve the issue? Can I launch multipass without 0 in IP?
127.0.0.1 would save your day!

Join Docker swarm manager

I user docker for Windows 10 and I try to use swarm, but I can't add a worker to the sarm.
I manage to create a manager like this :
docker swarm init --advertise-addr my-ip-addr:2377
Then I have this answer :
Swarm initialized: current node (uv8kzentx6jugl855a26e5qad) is now a
manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-4ff8ldvzoasrbq0iprugdb5owqrzx5chyudbm7uu4r11t6dz0i-6om1gepq4yqm1s70a6gq75qtr
my-ip-addr:2377
To add a manager to this swarm, run 'docker swarm join-token manager'
and follow the instructions.
Then , from my remote machine ( in the same network than the manager) I run the following command :
docker swarm join --token SWMTKN-1-4ff8ldvzoasrbq0iprugdb5owqrzx5chyudbm7uu4r11t6dz0i-6om1gepq4yqm1s70a6gq75qtr my-ip-addr:2377
But I have this issue:
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.
Why do I have this issue ? What should I do ?
thanks in advance

Docker Swarm mode routing mesh not working with wireguard VPN

I'm trying to setup a 3 node Docker swarm cluster on Hetzner cloud, using wireguard VPN (setup on interface wg0) to build the local network between nodes. Networking works fine across nodes using VPN IP (ports 7946/tcp , 7946/udp and 4789/udp are open as reported here). I start docker swarm cluster with the following commands:
docker swarm init --advertise-addr wg0 --listen-addr wg0
docker swarm join --token SWMTKN-1-xxx --advertise-addr wg0 --listen-addr wg0 10.0.0.1:2377
If I try to run a service on this swarm, it seems to run correctly, every container can reach the other on different node and inspecting them, they join the ingress network and an overlay network created by me, as expected. The problem arises when I try to access from outside the service exposed port; it only works if I target the node where the container is running, so it seems that the routing mesh is not correctly working. I've not found any error in docker logs or syslog.
Note: I'm using docker 18.06.1-ce
I had this issue and made the following changes:
I moved my wireguard addresses from 10.0.* to 192.168.* (i have a feeling that swarm is allocating on top of these).
docker swarm init --advertise-addr 192.168.2.123 with the wireguard ip4 address of the master node.
That managed to fix it, and it still works after rebooting the master and worker nodes!

Docker swarm join linux container Error - remote CA does not match fingerprint

Start docker swarm :
docker swarm init --advertise-addr
Join docker swarm:
docker swarm join --token :2377
I am using Windows 10,
it is working fine with Windows container mode, but gives below error in Linux container mode.
Error:
Error response from daemon: remote CA does not match fingerprint. Expected: 91030413f17ec7c023a2a796ee05a024915080ca8dfd646a597c7e966f667df6
Docker swarm manager host command: docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
2zf1l2o7sl2a1qka55s2vi77x * moby Ready Active Leader
Host name is moby, when running in Windows container mode it gives machine host correctly.
Your token is wrong.
You can get a worker token in the manager node:
docker swarm join-token -q worker
It works for me.
https://docs.docker.com/engine/reference/commandline/swarm_join/

docker swarm init could not choose an IP address error

Experimenting with Docker Swarm with Docker Desktop for Mac. I tried this:
docker-machine create -d virtualbox node-1
docker-machine create -d virtualbox node-2
docker-machine create -d virtualbox node-3
eval $(docker-machine env node-1)
docker swarm init \
--secret my-secret \
--auto-accept worker \
--listen-addr $(docker-machine ip node-1):2377
The last command (docker swarm init) returns this error:
Error response from daemon: could not choose an IP address to
advertise since this system has multiple addresses
I have no idea what's going on. Anyone have any idea how to debug?
First look for the public IP of your machine on your network
ifconfig
pick the physical one like 192.168.1.x (not docker0, that is a virtual IP internal to Docker)
docker swarm init --advertise-addr 192.1.68.1.x
(will default to port 2377)
Update 2017-05-24:
The prior answer was for an early state of swarm mode. The secret and auto-accept options have since been removed, and the advertise-addr option has been added. This can now by done with:
docker swarm init \
--advertise-addr $(docker-machine ip node-1)
The port will default to 2377. You can also use a network interface name instead of an IP address and swarm will lookup the IP address on that interface. The listener address is still an option but the default is to listen on all interfaces which is typically the preferred solution.
Original answer:
I haven't done this with docker-machine yet, but I do know that the new swarm is very sensitive to the entries in /etc/hosts. Make sure your ip and hostname are in that file, and only in a single place (not also mapped to loopback or any other internal addresses). As of RC3, they are also using the listener address for the advertise address, too, so make sure this hostname or ip can be referenced by all nodes in the swarm (pretty sure a fix is coming for that, if not already here).
To minimize the risk of issues between client and server versions, I'd also run the commands directly inside the virtualbox, rather than with docker-machine environment variables.
According to DockerĀ“s guide: https://docs.docker.com/get-started/part4/#create-a-cluster
Getting an error about needing to use --advertise-addr?
Copy the IP address for your virtual machine by running docker-machine
ls, then run the docker swarm init command again, using that IP and
specifying port 2377 (the port for swarm joins) with --advertise-addr.
For example:
docker-machine ssh myvm1 "docker swarm init --advertise-addr
192.168.99.100:2377"
This works for me
docker swarm init --advertise-addr 127.0.0.1
Got the same error when using docker with envs to connect to the docker-machine-created machine.
After docker-machine ssh <machine-name>, and doing the docker swarm init locally on the machine, I got the message about --advertise-addr as well. The local command docker swarm init --listen-addr 192.168.99.100:2377 --advertise-addr 192.168.99.100:2377 then worked.
Check docker --version and make sure client and server are on the same version. If they are different, use the following command to pull the boot2docker version that matches with the docker client on your machine.
docker-machine create --driver virtualbox --virtualbox-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.12.0-rc4/boot2docker-experimental.iso manager1
Please ssh into the node 1 and then apply same command over there

Resources