Introduction to Docker- Part 1

Why do we need Docker ?

To maintain isolation. We isolate services. High Availability, load handling, better up time and many other things.

Let say we want to deploy an application on a server(ubuntu/centos) and iut requires nginix 2.6. And now we want to deploy another application on the same server which require nginx 3.0. However, this is not possible. On a machine a single software can be installed with a specific version only.

We Require Isolation

  • To host our app we need infrastructure
  • We use VM/Cloud computing to setup infra
  • We isolate our services in OS of VM
  • Because of isolation we end up setting many VMs/instances
  • VMs/instances will be over provisioned
  • These factors increases the cost

So as to handle this scenario Virtualization came into picture. Virtualization is a device which is created by a piece of software. But before that we need to understand a bit about hypervisors.

Hypervisor is a piece of software running on a physical machine. There are 2 types of Hypervisors:
– Hypervisor 1(Hardware): they come as a iso package and are installed along with the operating system. Example: ESXI
– Hypervisor 2(Software): It is a software installed on top of OS. Example oracle virtual box

Now using the hypervisors we can create 2 vitual machines where we can install 2 different versions of nginx.

Disadvantages of Virtualization

  • Takes a lot of time to create a VM
  • If the host OS crashes, we cannot access the VM
  • We can create limited VM from the limited RAM available in host machine
  • Every VM has OS
  • OS needs nurturing and licensing
  • OS takes time to boot
  • VM’s are portable but bulky
  • VM’s needs resources for its OS
  • All this is done just to isolate our services

Now imagine multiple services running in the same OS but isolated. Will that be great ? Yes indeed. It would save us a lot of money. That’s what a container is. Docker is a container based technology.

Containers

From a kernel point of view, container is just a process.

From a storage point of view, container is a directory which is having its separate CPU, separate binaries, separate process tree, separate IP address. Its processes are isolated from the host OS processes.

No alt text provided for this image

Containers share the machine’s OS system kernel and therefore do not require an OS per application.

A container is a standard unit of software that packages up

  • Code
  • Dependencies

Difference Between Container and VM’s

No alt text provided for this image
  • Containers offer isolation not virtualization
  • Containers are OS virtualization
  • VM’s are Hardware virtualization
  • VM needs OS
  • Containers don’t need OS
  • Containers uses Host OS for Compute resource

Previously, building and running a container was a nightmare. But then came Docker.

So what’s Docker ?

When we say docker, we should be more specific about which docker are we talking.

  • Docker Inc – the company name
  • Docker Engine – service that is used to manage containers(creating and running containers).
  • Docker Project (Open Source)

Generally when people mention Docker, they usually refer to Docker Engine.

Architecture of Docker Engine

No alt text provided for this image

Docker Containers

Docker containers are just like normal containers which we discussed previously but with some extra feature such as extra network, extra security, and are lightweight.

No alt text provided for this image

In next blog we will have a look into how to install docker.

About the author

Deepak Sood

Deepak Sood is Lead Consultant in an IT firm holding expertise in Devops and QA Architecture with 8 years of experience.

His expertise is in building highly scalable frameworks. His skills include Java, Configuration Management, Containers, and Kubernetes.

Reach out to him using contact form.

View all posts