Microservices with Docker - part 1

A gentle, pragmatic introduction to Microservice Architecture and Docker.

In this part 1 of a post series, we are going to give a brief introduction to Microservices and to the Docker platform.

Microservice Architecture

Microservice architecture is a way of designing software applications as composed of modules of independently deployable services.
Thus, an application following the Microservices paradigm is built of small services, each running its own process and communicating through some APIs, HTTP, or other.
A Microservice Architecture-based  application is opposite to “old-style” Monolithic applications.

(Picture from M. Fowler, Microservices)

As intuitable, the basic components in a Microservice Architecture are represented by services, which are independently deployable software components. A service is somewhat different from a library. Examples of services in a Microservice Architecture application can be: an authentication deployed module, an API part dedicated to handle payments, a user database service, ...

For example, as stated in M. Fowler, Microservices, if you have a classic application depending on several libraries:

“a change to any single component results in having to redeploy the entire application. But if that application is decomposed into multiple services, you can expect many single service changes to only require that service to be redeployed.”

Microservices aren’t a relative new concept, but they’re quickly becoming popular, facing common architectural issues about development, deployment and scaling of (simple to) complex modern web applications. Microservice Architecture paradigm is platform and programming languages agnostic. For example, Docker could be a suitable platform to design, develop, deploy and run Microservices on a controlled, comfortable environment. But, also you can build your Microservices implementation using other tools or platforms or by building your infrastructure as well.

What is Docker?

As described on the Docker website, Docker is:

“a platform for developers and sysadmins to develop, ship, and run applications. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code. Docker lets you get your code tested and deployed into production as fast as possible.”

Screen Shot 2015-04-13 at 11.09.22.png

Classic Virtual Machines vs. Docker (Picture from Docker docs)

Thus, why Docker?

  • - to build and scale Microservice Architecture-based applications
  • - to isolate and independently develop Microservices
  • - to simplify a development configuration/environment
  • - to share applications and their environment with other developers (in the same team or not)
  • ...
Basically, Docker technology consists of:

The Docker Engine

A lightweight and powerful container virtualization technology combined with a work flow for building and containerizing applications. The Docker Engine daemon is the Docker component which builds, runs and distributes the Docker Containers.

The Docker Hub

A service for sharing and managing application images. It is a repository which holds usable Docker Images. You can use the Docker registry for free or under a fee and have open-source public  images and private Images.

The Docker Client

The Docker client connects to the Docker Engine Daemon (local or remotely) and accepts all the Docker commands, like docker pull or docker run. 


Images are templates for Docker applications. An Image it’s like a composable component to use to create application stacks. For example, can be an Ubuntu image or a Redis image based on Ubuntu, etc…


A Container is created from a Docker Image. Think about it as an instantiation (a Container, a running instance) from a class (an image) in the OOP paradigm. Containers can be started, stopped, etc…

The Docker Architecture overview (from Docker website)

On a Linux-based host, a Docker environment can be summarized by the following picture. We run a Docker Engine to build and run our Containers - created from Docker Images - and managing the Docker environment through the Docker client command.

A Docker environment in case of a Linux host

So, for example, with Docker we can quickly build and deploy a microservices-based application which uses NGINX and node.js Images, pulling them from the Docker Hub and instantiating and running them as Containers. We can run our code on the second, node.js Container and link the NGINX container to serve as reverse proxy for the entire Web app. All of them as Microservices running on separate modules.
In the (coming soon) part 2 of this article series we will describe how to pragmatically use Docker and its commands to pull Images, to run Containers and to manage them. Where, on a future post in this series we will learn how configure and run a dockerized node.js/express application.

Stay tuned!


Popular posts from this blog

Transform a CSV file into a JSON file with Python