How To Create docker Cluster Using Swarm On Linux

How To Create Docker Cluster 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.

Check Out: How To Install PHPMyAdmin For Accessing Database On CentOS 7

How To Create docker Cluster Using Swarm On Linux:

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

Check Out: How To Run Multiple Tomcat Instances On Single Linux Server

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

docker cluster setup

Check Out: How To Install Monit Process Monitoring Tool On Linux 7

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

docker swarm ports

Check Out: How To Access Kibana Dashboard Using Domain Name On Linux

Check Manager node is ready or not,

docker node ls

configure swarm docker

Worker Node:

Install the docker and start the service on the worker node.

Check Out: How To Configure Rancher Container Orchestration Server In Linux

After installing, you need to join this node with a docker swarm by using the below command.

docker swarm join --token SWMTKN-1-4pxjdtzhuo05430bjua1e06zvdcv2aa8yff4l3fs5cghr5uy7b-3m5lguezvt2fz14t1wnaccp30

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.

container cluster

Check Out: Configure Role-Based User Access In Jenkins Server On Linux

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.

That’s it. container cluster configure swarm docker docker swarm ports docker cluster setup

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment