Create Cluster using docker swarm

Mohamed Fawzy
tajawal
Published in
2 min readJul 29, 2018

Introduction

Docker Swarm is a clustering and scheduling tool for Docker containers. With Swarm, IT administrators and developers can establish and manage a cluster of Docker nodes as a single virtual system.

Requirements:

1-Docker machine

2- Virtual box

3-Docker swarm

Setting up cluster with docker swarm

  • Set up the docker host using docker machine and virtual machine .
docker-machine create -d virtualbox vm1
docker-machine create -d virtualbox vm2
  • Verfiy your machines with command docker-machine ls you should see two machines ended with 10x and names vmx
  • Create cluster manager for machine vm with the following command docker-machine ssh vm1 "docker swarm init --advertise-addr 192.168.99.100
  • You should see something like this
  • Join cluster with the following command docker-machine ssh vm2 "docker swarm join --token <token> 192.168.99.100:2377"
  • Confirm docker cluster with the following command docker-machine ssh vm1 "docker node ls"
  • You should see something similar to this image .

That’s it , Now you have a cluster manager and node connected to it using docker swarm .

--

--

Mohamed Fawzy
tajawal

Traveler in space and time, Part-time Researcher in Deep learning, High-performance computing, Software architecture.