Dot Net For All

Starting with Docker

Hello Friends, dockers and containers have been around since quite some time. And it will be the the technology of the future. In this article I will help you to start with Docker and understand why docker has been introduced.

In this article I will help you to understand the below points:

Why do we need docker

What is docker

Difference between Docker and VM

What is a Docker Image

Why Docker

  1. There are two ways we can run applications in cloud. Iaas and Paas I.e. Infrastructure as a service and Platform as service.​
  2. Iaas provides benefits of moving across the cloud but with higher costs where you spin VM for each component.​
  3. Paas provides individual platforms for each service like serverless functions, SQL server. But it is highly coupled to the cloud and to make it cloud agnostic could be a daunting task.​
  4. Docker provides the third option to move each component to individual container.​
  5. Docker introduced the concept of micro services.​
  6. Docker helps you get your existing apps to the cloud, whether they’re distributed apps or monoliths​

What is Docker

  1. Docker is a platform that lets you package, develop and run applications in containers.​
  2. Container is a virtual environment on top of OS kernel to capture all its software, libraries, dependencies etc.​
  3. Containers share the CPU and memory of the computer as well as the computer’s OS.​
  4. This solves the problem of isolation and density.

Difference between VM and Container

  1. The original attempt to solve the problem of isolation and density was VM or virtual machine.​
  2. Its similar as container but it has its own OS and kernel. It doesn’t share the OS with host computer.​
  3. This makes VM to consume lots of memory as well as CPU to run its own OS. Licensing cost of OS and maintenance burden are other implications.​
  4. Containers shares the OS of the host computer making it lightweight.​
  5. Containers start quickly and run quickly. We can have 5 to 10 times containers on the same hardware as compared to Vm’s.​
  6. We get density as well as isolation making the most efficient use of hardware. This makes containers more efficient.​
  7. Virtual machine abstracts an entire computer system. They virtualize everything from the entire file system, kernel for managing users and more.​
  8. The file system between each of  containers is shared. Since the file system is shared it would be used by all the containers and wouldn’t be re downloaded. We can start any number of containers without overloading host machines space.

What is a Docker Image

  1. Docker Images are read only templates with instruction for creating a docker container.​
  2. Instructions define the container code, libraries, environment variables, configuration files and more.​
  3. These instructions  are collected within the executable package. When we run this executable package we create the container. Containers are result of executing these instructions.​
  4. We can use the analogy of object and class in OOP to define the relationship between Image and container.​

Top career enhancing courses you can't miss

My Learning Resource

Excel your system design interview