Introduction to Docker and Container Based Application

dilshan ukwattage
Nerd For Tech
Published in
7 min readJun 9, 2021

--

If you are an undergraduate IT student or a software engineer you may heard containers or docker at some point in your career. If you heard those, but if you don’t know anything about those then you are in the right place because this article is for you. This article will give you an introduction to container based application. Before that we will take look about the history.

Generation 1

In the past applications are deployed in a physical server. But you think now a days is not deployed in physical sever. Yes now a days also deployed in a physical server but in the past let’s say we have application server, database server and web server so those days people used three different physical hardware boxes for that. People faced lot’s of problems. Those are,

  1. need to maintain
  2. needs lot’s of space
  3. need a separate network
  4. cost is high

More than above there is a wastage because your app server or web server may not used 100% of processing power and memory.

Generation 2(Hypervisor)

If you are in this software developing industry for a while you have came cross some scenarios where your application works on your development machine but not working some one else machine.(may be one of the testing teams machine or operational teams machine) There is nothing wrong with the application. So why this happen. this can happen,

  1. One or more file is missing.
  2. Software version mismatch between target machine and develop machine.
  3. Different configuration settings

This is where hypervisors came to the picture. In generation 2 people used hypervisor to solve those. So now when you give your application don’t just give the application. You can give the entire image of the virtual machine’s operating system(OS) (virtual image)to someone else. So once they get the virtual image image they can create a instance from it. Now they don’t need to worry about the files,dependencies and versions of the software because you have already given an image of the OS which contains those all.

There are two types of Hypervisors. Those are

  1. Type 1 (Bare Metal Architecture)
  2. Type 2 (Hosted Architecture)

A Type 1 hypervisor runs directly on the host machine’s physical hardware, and it’s referred to as a bare-metal hypervisor. So in Type 1 hypervisor used High Processing hardware box. On top of that people installed hypervisor. Then they created multiple virtual machines(VM) on top of hypervisor. Next we can install different kind of operating system(OS) on top of VM’s. Finally we can install the applications.

Typically, a Type 2 hypervisor is installed on top of an existing operating system. Since it relies on the host machine’s preexisting OS to manage calls to CPU, memory, storage, and network resources, it’s frequently referred to as a hosted hypervisor.

Hypervisor was a great concept and it solve some of our problems that we have in the first generation but still there are some drawbacks. Let’s see what are the advantages and disadvantages of this generation.

Advantages

  1. Let’s say for VM 1 we use 20% of processing power and for VM 2 use 10% and VM 3 use 20% of processing power. So all together 50% used of the processing power and remain 50% processing power can be used for any other tasks. So wastage is no there like in the previous generation.

Disadvantages

  1. Each and every application need a separate operating systems (OS). Then since we are having multiple OS we have OS licensing cost.
  2. Have to maintain OS and update recently.
  3. Slow to start. Take some time because staring a VM is not a 1 or 2 second work.
  4. Sharing resources need lots of configurations

Generation 3 (Containers)

Generation 3 is all about containers. Containers are a lighter-weight, more agile way of handling virtualization. A container is a lightweight, stand alone, executable package of a piece of software that includes everything needed to run it. So it’s a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.

So in the Generation 3 as you can see the above picture we have hardware and on top of that we have a the OS. Then we have containerize engine on top of the OS. Next we can have multiple containers on top of the engine. finally we can have applications. So each any every container can run it’s own application. You can enjoy faster resource provisioning and speedier availability of new applications. All containers in a single machine use Host OS so we only need to license, patch and maintain update only one OS. Containers have been around for almost decade, but the current container era began in 2013 with the release of Docker. I will be explaining about docker in the below of this article. Some people think containers are replacement for VM’s. That’s totally wrong because containers have some benefits over VM’s but it doesn’t say that containers are replacement to VM’s.

Advantages

  1. very light weight comparing to VM’s.
  2. When we use containers or docker we don’t need separate operating systems. So we don’t need separate virtual machines. Now we save lot of spaces and now we can use those spaces for more and more containers.
  3. Since we don’t have multiple operating systems we don’t need multiple OS licensing and updates.
  4. Since all the containers are on top of OS and containerization engine starting your application is very quick because OS is already started.
  5. Sharing resources is very fast.
  6. platform independent

Welcome to Docker

Being the first in the market or being initiative or being the leader of the market some people understand those technology by that name. So docker is something like that. Some developers may know docker instead of containers. Docker is a popular open source project written in go and developed by Dotcloud. Docker is a platform for building, running and shipping applications in a consistent manner. Using docker we can easily package our application everything you need and run it any other machine with docker.

Docker Engine

Docker engine is not a part of docker project. Docker Engine is the core product of Docker. Docker Engine is the layer on which Docker runs. It is installed on the host machine. It’s a lightweight runtime and tooling that manages containers, images, builds, and more.

Docker Image

A Docker Image is a read-only template used for creating Docker containers. Image contains everything our application need to run. It contains all of the installations, runtime environments, application files, dependencies, third party libraries.

Docker Container

In simply Docker container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI.

Docker Registry

A Docker registry is a storage and distribution system for named Docker images. So simply A place where you can store your docker images. Multiple copies of the same image may exist, each with its own set of tags. A Docker registry is organized into Docker repositories , where a repository holds all the versions of a specific image.

Container Orchestration

Container orchestration is the automatic process of managing or scheduling the work of individual containers for applications based on micro services within multiple clusters. There are many container orchestration tools that can be used for container lifecycle management. Some popular options are Kubernetes, Docker Swarm and Apache Mesos.

Kubernetes

Kubernetes, also known as K8s is a popular open source container-orchestration system for automating computer application deployment, scaling, and management. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation.

You have reached to the end of this article. I hope you learn about the history of the containerized application as well as docker. So keep learning and let’s meet from another article. Stay in touch.

--

--

dilshan ukwattage
Nerd For Tech

Software Engineer at IFS R&D International (Pvt) Ltd