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.

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

You can download the docker repository from here

wget https://download.docker.com/linux/centos/docker-ce.repo

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 192.168.223.131

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 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.

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.

You’re done. container cluster configure swarm docker docker swarm ports docker cluster setup

LEAVE A REPLY

Please enter your comment!
Please enter your name here