Join Server4 to a Docker Swarm

In Server1 Join as a manager node

To retrieve the join command including the join token for manager nodes, run the following command on a manager node:

docker swarm join-token manager

To add a manager to this swarm, run the following command:

docker swarm join \
    --token SWMTKN-1-18sa2yylfvsqcr6hun5ka2w9cmbl3id1l8c315rqa8eqs5m2zx-bcyfbpq0zszuuc1njlz1pt36s 18.234.73.13:2377

In Server4 Run output from Server1

 docker swarm join \
    --token SWMTKN-1-****-*** \
    18.234.73.13:2377 \
    --advertise-addr <server4 public-IP address>  

Then test it like so:

docker node ls

The output:

ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
dkp8vy1dq1kxleu9g4u78tlag *  manager2  Ready   Active        Reachable
dvfxp4zseq4s0rih1selh0d20    manager1  Ready   Active        Leader

Make sure the network works for all servers:

docker network ls 

The output:

The swarm overlay test-network must be exist for all serversThe swarm overlay test-network must be exist for all servers

The swarm overlay test-network must be exist for all servers