Deploy new swarm-node and why swarm1 and swarm2 work differently?

I have swarm1 and swarm2

when I execute docker ps

the swarm1:
mervo@SharkBay:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6205476619d2 gliderlabs/registrator:latest “/bin/registrator con” 2 minutes ago Up 2 minutes reverent_morse
48be0e329479 swarm:latest “/swarm join --advert” 22 minutes ago Up 22 minutes swarm-agent
mervo@SharkBay:~$

the swarm2 got this

mervo@SharkBay:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3beb31588656 swarm:latest “/swarm join --advert” 25 minutes ago Up 25 minutes swarm-agent
207adc98beb5 swarm:latest “/swarm manage --tlsv” 25 minutes ago Up 25 minutes swarm-agent-master
mervo@SharkBay:~$

Question

  1. Why swarm manage only in swarm2?
  2. why the registrator only in swarm 1?

F

Do you have the commands used to set up the swarm cluster? I can then provide you specific commands to view your cluster.

Essentially, it seems you have one cluster. with swarm 2 as the manager (or master if you will) and both swarm 1 an swarm 2 as member’s of the cluster. This is why you see swarm manage as a container on swarm 2 and a swarm join each on swarm 1 and swarm 2. When you run docker ps, it is a client side command that targets a docker server / daemon. By default it will target the localhost, which is why you see different results because you are targeting different hosts. If you target the swarm manager and then run docker ps, you will see all containers running in your cluster. Two way of targeting the swarm manager (or any docker daemon really) is by passing -H tcp://<ip>:<port> to the docker client command OR by setting the environment variable DOCKER_HOST.

Please refer to this link as it has pertinent info related to your issue: https://docs.docker.com/swarm/discovery/