How To Create docker Cluster Using Swarm On Linux
How To Create Docker CE is also known as a docker swarm. You just need to install the docker-ce in any Linux flavor or windows server. Configure swarm and container cluster setup using docker. You can also add ports for docker swarm.
You can download the docker repository from here
Once the download the repository put these repo under this location
Install the docker engine using the below commands.
yum install docker-ce -y
Start the services
systemctl start docker && systemctl enable docker
Now start the docker swarm with IP address where you want to deploy it as manager and another node as workers.
docker swarm init –advertise-addr 192.168.223.131
You need to add ports in the firewall using the below commands.
firewall-cmd --add-port=2376/tcp --permanent firewall-cmd --add-port=2377/tcp --permanent firewall-cmd --add-port=7946/tcp --permanent firewall-cmd --add-port=7946/udp --permanent firewall-cmd --add-port=4789/udp --permanent firewall-cmd --reload
Check Manager node is ready or not,
docker node ls
Install the docker and start the service on the worker node.
After installing, you need to join this node with docker swarm by using the below command.
docker swarm join --token SWMTKN-1-4pxjdtzhuo05430bjua1e06zvdcv2aa8yff4l3fs5cghr5uy7b-3m5lguezvt2fz14t1wnaccp30 192.168.223.131:2377
Now you will see a message like this “This node joined a swarm as worker”. It means the worker node joined by the manager node.
After these steps, check whether the worker node is joined the master node with the below command.
docker node ls
In the same, way you can add more workers node.
You’re done. container cluster configure swarm docker docker swarm ports docker cluster setup