sudo vim /etc/hosts
192.168.89.102 managernode
192.168.89.103 workernode1
192.168.89.104 workernode2
sudo hostnamectl set-hostname managernode
sudo hostnamectl set-hostname workernode1
sudo hostnamectl set-hostname workernode2
sudo firewall-cmd --permanent --add-port=2376/tcp
sudo firewall-cmd --permanent --add-port=2377/tcp
sudo firewall-cmd --permanent --add-port=7946/tcp
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=7946/udp
sudo firewall-cmd --permanent --add-port=4789/udp
sudo firewall-cmd --reload
sudo systemctl restart docker
Manager node
sudo docker swarm init --force-new-cluster
Worker node
Docker swarm uses port 2377 by default.
sudo swarm join --token <token> <MANAGER_IP_ADDRESS>:2377