HTML JavaScript Python CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
docs swarm mode update Aug 1, 2017
rest-ip swarm mode update Aug 1, 2017
LICENSE swarm mode update Aug 1, 2017

Continuous Deployment with Docker (swarm mode)


This project shows a web application built using a microservices architecture.

There are two microservices:

  • rest-count implemented in Python (Flask microframework) using a Redis database
  • rest-ip implemented in Node.js (Express framework) using a MongoDB database

deployed as docker services on a swarm cluster

You can find additional information on my Slideshare presentation "Always be shipping"



Docker 17.06.0-ce

(see legacy tag if you're interested into the previous version for Docker 1.11 using docker-compose and consul.)

Getting started

run on a single node docker swarm cluster the following commands in terminal (the first time you have to wait for a few minutes to download the Docker base images), :

docker stack deploy -c docker-compose.yml cd

open your browser to

you can check the services on

now edit rest-count/ (for example, you can increase the version to 1.1)

docker build -t francescou/rest-count:1.1 rest-count/

docker service update --image francescou/rest-count:1.1 cd_restcount

the updated microservice will be deployed with no downtime.

You can also modify the rest-ip microservice in the same way (see rest-ip/app.js).

Scaling microservices

this section will explain how to can scale up and down the docker services.

open your browser to There you will find a rest-count service, running on two replicas. Execute

docker service scale cd_restcount=4

check again to ensure that there are now four rest-count instance.

Make a few requests to and then run docker service logs cd_restcount to see how requests are processed by different rest-count instances.

You can now scale down the rest-count service without having any down time, e.g.:

docker service scale cd_restcount=2

Again, you can check to see that there are now only two instances.