Spread the love


Docker Engine 1.12 can be rightly called ” A Next Generation Docker Clustering & Distributed System”. Though Docker Engine 1.12 Final Release is around corner but the recent RC2 brings lots of improvements and exciting features. One of the major highlight of this release is Docker Swarm Mode which provides powerful yet optional ability to create coordinated groups of decentralized Docker Engines. Swarm Mode combines your engine in swarms of any scale. It’s self-organizing and self-healing. It enables infrastructure-agnostic topology.The newer version democratizes orchestration with out-of-box capabilities for multi-container on multi-host app deployments as shown below:

Built on Engine as a uniform building block for self organizing and healing group of Engines, Docker ensures that orchestration is accessible for every developer and operation user. The new Swarm Mode adopts  the de-centralized architecture rather than centralized one (key-value store) as seen in the earlier  Swarm releases. Swarm Mode uses the Raft consensus algorithm  to perform leader selection, and maintain the cluster’s states.

In Swarm Mode, all Docker Engine will unite into a cluster with management tier. It is basically master – slave system but all Docker Engine will be united and they will maintain a cluster state. Instead of running a single container, you will declare a desired state for your application which means multiple container and then engine themselves will maintain that state. Additionally, a new “docker service” feature has been added under the new release. The “docker service create” is expected to be an evolution of “docker run”. Docker run is imperative command and all it helps you  to get container up and running.The new “docker service create” command declare that you have to setup a server which can run one or more containers and those container will run , provided the state you declare for the service will be maintained in Engine / inside the distributed store based on raft consensus protocol.That brings the notion of desired state reconciliation. Whenever any node in the cluster goes down, the swarm itself will recognize that there has been deviation between the desired state and it will bring up  new instance to reconstruct the reconciliation. I highly recommend visualizing http://thesecretlivesofdata.com/raft/ to understand what does it mean.

Docker Swarm Node is used  for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and much more. Let’s see what features does Docker Swarm Mode adds to Docker Cluster functionality:Pic-6

Looking at the above features, Docker Swarm mode brings the following benefits :

  • Distributed: Swarm Mode uses the Raft Consensus Algorithm in order to coordinate and does not rely on a single point of failure to perform decisions.
  • Secure: Node communication and membership within a Swarm are secure out of the box. Swarm Mode uses mutual TLS for node authentication, role authorization and transport encryption, automating both certificate issuance and rotation.
  • Simple: Swarm Mode is operationally simple and minimizes infrastructure dependencies. It does not need an external database to operate. It uses internal distributed State store.

Below picture depicts Swarm Mode cluster architecture. Fundamentally its a master and slave architecture. Every node in a swarm is Docker Host running Docker Engine. Some of the node has privilege role called Manager.The manager node participate in “raft consensus” group. As shown below, components in blue color are sharing Internal Distributed State
store of the cluster while the green colored components/boxes are worker Nodes. The worker node receive work instructions from the manager group and this is clearly shown in dash lines.Pic-3

Below picture shows how Docker Engine Swarm Mode nodes works together:


For operation team, it might be relief-tablet as there is no need of any external key-value store like etcd and consul.Docker Engine 1.12 has internal distributed state store to coordinate and hence no longer single point of failure. Additionally, Docker security is no longer an additional implementation,the secure mode is enabled by default.

Getting started with Docker Engine 1.12

Under this blog post, I will cover the following aspects:

  1. Initializing the Swarm Mode
  2. Creating the services and Tasks
  3. Scaling the Service
  4. Rolling Updates
  5. Promoting the node to Manager group

To test drive Docker Mode, I used 4 node cluster in Google Cloud Engine all running the latest stable Ubuntu 16.04 system as shown below:


Setting up docker 1.12-rc2 on all the nodes should be simple enough with the below command:

                                                      #curl -fsSL https://test.docker.com/ | sh

Run the below command to initialize Swarm Mode under the master node:


Let’s look at docker info command:


Listing the Docker Swarm Master node:


Let us add the first Swarm agent node(worker node) as shown below:


Let’s go back to Swarm Master Node to see the latest Swarm Mode status:


Similarly, we can add the 2nd Swarm agent node to Swarm Mode list:


Finally, we see all the nodes listed:


Let’s add 3rd Swarm Agent node in the similar fashion as shown above:


Finally, the list of worker and master nodes gets displayed as shown below:

Let’s try creating a single service:


As of now, we dont have any service created. Let’s start creating a service called collab which uses busybox image from Dockerhub and all it does is ping collabnix.com website.


Verifying and inspecting the services is done through the below command:




Quick Look at Scaling !!!

Task is an atomic unit of service.We actually create a task whenever we add a new service. For example, as shown below we created a task called collab.


Let’s scale this service to 5:


Now you can see that the service has been scaled to 5.


Rolling Updates Made Easy

Updating a service is pretty simple. The “docker service update” is feature rich and provides loads of options to play around with the service.


Let’s try updating redis container from 3.0.6 to 3.0.7 with 10s delay and parallelism count of 2.


Wow !!! Rolling updates just went flawless.

Time to promote the Agent Node to Manager Node

Let’s try to promote Swarm Agent Node-1 to Manager group as shown below:


In short, Swarm Mode is definitely a neat and powerful feature which provides an easy way to orchestrate Docker containers and replication of services. In our next post, we will look at how overlay networking works under Swarm Mode.


Spread the love

Ajeet Raina

My name is Ajeet Singh Raina and I am an author of this blogging site. I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I bagged 2 special awards last year(2019): Firstly, “The Tip of Captain’s Hat Award” at Dockercon 2019, San Francisco, and secondly, “2019 Docker Community Award“. I run Collabnix Community Slack with over 5300+ audience . I have built popular GITHUB repositories like DockerLabs, KubeLabs, Kubetools, RedisPlanet Terraform etc. with the support of Collabnix Community. Currently working as Developer Relations Manager at Redis Labs where I help customers and community members adopt Redis. With over 12,000+ followers over LinkedIn & close to 5100+ twitter followers, I like sharing Docker and Kubernetes related content . You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)


fp · 30th June 2016 at 2:26 pm

apparently once a worker is promoted as a manager (‘node ls’ will show ‘manager status’ as ‘Leader’ & ‘Reachable’) there’s still no manager failover – would expect if the ‘Leader’ goes down the other manager will take over thought that’s not the case at all … once a manager goes down the all swarm is no longer reachable ? (found same problem reported here ‘https://forums.docker.com/t/will-docker-swarm-1-12-support-multiple-managers/17020’) — are we missing anything in there ? so far, I couldn’t find any posts on how manager failover is working with docker engine 1.12 swarm mode – any thoughts would be really appreciated.

Oscar · 4th July 2016 at 8:33 am

A very good introduction and tutorial. If I have you permission, I would like to translate the series (including networking model overview) into chinese and put it at wechat page (with source URL on the page). I will appreciate it if you could authorize me to do that. Thank you

Bill · 29th July 2016 at 5:14 am

You have made some decent points there. I looked on the internet to find out more
about the issue and found most individuals will go along with your views on this website. http://www.yahoo.net

MarilouUDort · 5th August 2016 at 5:46 am

Touche. Outstanding arguments. Maintain the great effort.

delhi escort · 7th August 2016 at 6:35 pm

Thanks a bunch for sharing this with all people you actually
know what you are talking approximately! Bookmarked.
Please additionally discuss with my site =). We could have a link exchange contract between us

Lynne · 13th August 2016 at 6:32 am

It is appropriatᥱ time to maкe ѕome plans fоr the longer term and it iѕ time
to bee ɦappy. І have rеad this post аnd if Ӏ may just
І desire tо recommend ʏoᥙ fеw interesting issues oг suggestions.
Mɑybe you could ᴡrite subsequent articles гegarding thіs article.
I want to rᥱad even morе issues аpproximately it!

Radarteam Cobra Penta · 17th August 2016 at 8:37 am

Hmm it appears like your blog ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog blogger but I’m still new to everything. Do you have any recommendations for rookie blog writers? I’d really appreciate it.

Drone Camera · 19th August 2016 at 2:26 am

It’s really a cool and useful piece of information. I am glad that you shared this useful information with us. Please keep us up to date like this. Thanks for sharing.

MyronCCarrea · 20th August 2016 at 3:48 am

Howdy! Do you use Twitter? I’d like to follow you if that would be okay.

I’m absolutely enjoying your blog and look forward to new

Http://mitalisharma.com/ · 27th August 2016 at 4:13 am

Whoa this is a valuable websites.

HueyMMccoyle · 27th August 2016 at 4:21 am

To start with I would like to say fantastic blog! I needed a
fast question which I’d prefer to ask should you not mind.
I used to be curious to find out the way you center yourself and clear your ideas prior to writing.
I have had a tricky time clearing my mind in getting my thoughts available.
I truly do take pleasure in writing nevertheless it just appears like the first ten or fifteen minutes are generally wasted just trying to
puzzle out how to begin. Any recommendations or hints?


DaniaUStever · 2nd September 2016 at 3:51 am

Hello, I like reading all your post. I wanted to write a
little comment to support you.

    ajeetraina · 2nd September 2016 at 11:06 am

    Go ahead. I welcome your suggestions.

KeithIRaider · 25th September 2016 at 8:16 pm

This is really interesting, You’re a very skilled blogger.
I have joined your rss feed and look forward to seeking more of your wonderful post.
Also, I have shared your website in my social networks!

    ajeetraina · 25th September 2016 at 8:21 pm

    Thanks for your time. Feel free to provide your feedback to improve this website.

NganJZrake · 3rd October 2016 at 7:04 pm

Hello there! Do you use Twitter? I’d like to follow
you if that would be okay. I’m undoubtedly enjoying your blog and look forward to new

AveryGShammo · 13th October 2016 at 3:11 am

Hi there! This is kind of off topic but I need some help from an established blog.

Is it tough to set up your own blog? I’m not very techincal but I can figure things out pretty fast.
I’m thinking about creating my own but I’m not sure where to start.

Do you have any ideas or suggestions? Thank you

the dive shop · 18th October 2016 at 5:06 am

Usually I do not rerad aricle on blogs, butt I wish
to saay that this write-up very compelled me to try and do it!

Your writing style has bedn amazed me. Thank you, very great post. http://mocarny.eu/dive1

HangDThorn · 16th November 2016 at 9:23 am

Hey! This is my first visit to your blog! We
are a team of volunteers and starting a whole new initiative within a community from the
same niche. Your site provided us useful information to work on. You
possess done a outstanding job!

urban decay liquid eyeliner naked 5 eyes makeup black wholesale · 19th March 2017 at 5:03 am

Docker Engine 1.12 comes with built-in Distribution & Orchestration System – Collabnix

uptotop · 9th April 2017 at 6:35 am

Thanks a lot for providing individuals with an exceptionally wonderful opportunity to read critical reviews from this blog. It’s always very brilliant and also jam-packed with amusement for me personally and my office acquaintances to visit your site at least 3 times in 7 days to learn the latest items you have got. Of course, I’m at all times contented for the eye-popping advice you serve. Some 3 facts on this page are easily the most beneficial we’ve ever had.

mac lipstick wholesale · 5th May 2017 at 1:17 pm

Docker Engine 1.12 comes with built-in Distribution & Orchestration System – Collabnix

DockerCon 2016: Just Wow! | Docker Blog · 24th June 2016 at 2:26 am

[…] Docker Engine 1.12 comes with built-in Distribution & Orchestration System by Ajeet Singh Raina […]

DockerCon 2016: Just Wow! | DevOps Home · 24th June 2016 at 3:08 am

[…] Docker Engine 1.12 comes with built-in Distribution & Orchestration System by Ajeet Singh Raina […]

Docker 1.12 Networking Model Explained.. – Collabnix · 29th June 2016 at 11:07 pm

[…] PrevDocker Engine 1.12 comes with built-in Distribution & Orchestration System […]

How Service Discovery works under Docker 1.12 – Collabnix · 28th July 2016 at 1:42 am

[…] To demonstrate Service Discovery  under Docker 1.12, let me leverage 6-node Swarm Mode cluster which I setup in my earlier blog. […]

Konfigurasi Swarm Cluster di openSUSE Leap (Docker 1.21) – ROAR · 20th October 2016 at 6:24 pm

[…] Refrensi: Pak Max Huang | Docker Engine 1.12 comes with built-in Distribution & Orchestration System […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Join Collabnix SlackIt's 100% FREE!

Get chance to chat with 5500+ DevOps Engineers !