Docker

Mona
3 min readOct 7, 2019

Various aspects of the Docker Container service

Consider we have a very large application.This application is broken down into smaller services,each running its own process and are independently deployable. These services can be termed as microservices that communicate with each other over a network to fulfil a particular goal.

Microservices

The idea behind building microservice is that large applications become easier to build and maintain when they are broken down into smaller composable pieces that work together.

Each component is developed seperately, and the application is then the sum of its constituent components.

The main advantage of using microservice architecture is -

  1. Applications are easier to build and maintain when they are broken down into smaller services.
  2. It is easy to include new technology stack in any module or service as dependencies are very less.
  3. If any of the services goes down then the whole application remains largely unaffected.

Docker

Let us understand the architecture of a docker.

We have a host machine and on top of the host machine there is a virtual machine. On top of this virtual machine there are multiple docker containers.

Each of this docker container contains dependencies for one microservice. We can define docker containers as light weight alternative of virtual machines.

In docker container you don’t have to preallocate any RAM or disk space. It will take RAM or disk space according to the requirement of the application.

In order to run docker container the host machine has to be Linux or Unix.

Docker container does not work on Windows System. If we have windows system then we require Linux or Unix Virtual Machine on top of Windows system to run the docker container.

We can configure the virtual machine to allocate RAM and hard disk combined for all the microservices and run docker containers belonging to virtual machine.

We can run several microservices in the same virtual machine by running various Docker containers for each microservice.

Docker in a Nutshell

A developer writes a code that defines application requirement or the dependencies in easy to write docker file. This docker file then produces docker images.

Docker containers are runtime instances of docker images. These docker images are uploaded on Docker Hub.

Docker Hub is Docker’s very own cloud repository. We can pull and upload images from docker hub.

The Production team can also pull the image and prepare their own container.

To install docker in Ubuntu :

$sudo apt-get update

Now install recommended packages -

$sudo apt-get install linux-image-extra-$(uname-r) linux-image-extra-virtual

$sudo apt-get install docker-engine

To start docker service -

$sudo service docker start

Various Docker Components

Docker Registry -A storage component for Docker Images. We use Docker Registry to control where our images are being stored.

It can be used to host private repositories and integrate image storage with in-house development workflow.

Docker Composer -It is easy to configure and run application made up of multiple containers.

For example we can have three containers in one YAML file and then run all three containers with a single command.

If we have an application which requires NGNIX and MySQL , we can create one file which would start both the containers as a service without the need to start each one separately.

Conclusion

Docker is a set of products delivered as platform as service designed to make it easier to create,deploy and run applications using containers.

Docker provides same environment for Development,Testing and Production.

--

--