Blogger news

Blogger templates

Tuesday, January 24, 2017

Docker Docker Docker

Docker and container technology is an absolutely bleeding edge technology which is going to hit like a storm in. In this article, I  am going to give you a quick introduction on what is docker and container technology in general and why do we need container technology or what problem will containers solve.  
So let's start this course with a brief but absolutely vital introduction about containers. I will explain what containers are and what value it bring to us. In order to understand what value container give us, we should know a bit IT history. It's all about applications. Back then, I mean very long back we used to build applications in the server in the ratio 1:1 as shown in the diagram below.

So every application we needed to deploy, we needed to buy and build a dedicated server for it. Say if we have 10 applications then we needed 10 servers hence 10 purchase orders, 10 operating systems license, 10 operating system installs etc etc etc. If we have the 11th app then had to go through the same pain again and so on. Think about the cost and time need to install an app. There was actually another nasty problem in the background which is the massive waste of system resources. So each of those servers we bought and built for each application we only run them a small fraction of its total capability and remaining all wastage of system resources. Say our application needs only 20% of total system resources then remaining 80% is a total wastage. what a waste? Bad old days isn't it?

Then started next era of virtualization. Virtualization can mean a lot of things to a lot of people. Well, we are interested only in hyper virtualization. What is that all about? Yes, that is nothing but virtual machines or in short VM's. The concept of virtual machine solves most of the problems, yes MOST of the problems but not all of that. Let's see virtual machines working model.

Virtualization solved the problem by splitting a server into multiple virtual machines and each virtual machine acts like a separate server but utilizing system resource of an actual physical server. Each virtual machine looks and behaves exactly like a physical machine, means we can run more than one application on a physical server or one app per virtual machine. Let's take a quick example say we have 5 applications and each app needs 15% of system resource so we can create 5 VM's on the same physical machine and can run all 5 applications on the same machine but on 5 different VMs. Wowww pretty cool isn't it? We have saved a lot and that was one of the nicest innovation which 1:1 application: server ratio to 1: many applications: server ratio. This is a massive improvement but it is not perfect, yes I mean it. Let's take a closer look why it is not perfect.

One app per VM is really great but each VM requires a complete OS. It means if we have 10 VMs we need fully licensed 10 operating systems. Every OS consumes the big amount of system resources. It means if we need to spin new app still have to go through the pain of complete VM setup including the complete installation and should bear the license cost of OS.

So needed more evolution, more innovation to get rid of all pains and yes docker and container technology opened the room to the big world which solved the pain we had. So what's is container and container technology?

At a high level, containers are a bit like virtual machines. They are an application runtime environment and we run the application inside them. When comparing containers with virtual machines is that containers are way more lightweight than virtual machines. So what's the difference? Yeah as I have mentioned before in VM model inside every VM we need to install an operating system. So if we have 20 VM's we need 20 installations of fully licensed operating systems. Boom cost cost.. time time time. Containers are fundamentally different. Let me explain with a quick diagram

Container Technology Architecture

The picture above describes container concept at a high level. Instead of multiple Operating systems like in VM's in container technology, there will be only one operating system but that operating system is virtualized across so-called blocks, container. Each and every container is capable of deploying one application and those containers share the operating system and system resources. Unlike VM's container consume fewer system resources as it required. In a nutshell, I would say container is still kind of virtualization but it is virtualizing operating system. Pretty cool isn't it? No hassles of installing one operating system each for one app, no need to bear the cost of multiple operating systems and no need to wait to get all installation done for an app to deploy. Without, all these hassles containers are much faster than VM and much easier to setup.

Containers are an isolated instance of user space. What does it mean? Well, it means a system with 5 containers has 5 isolated independent userspace and can independently deploy 5 different applications. It is completely isolated in such a way that one process in one container cannot send anything to another container processes. Each container will have it's own IP address and port range.

So what is docker and how it fits with container technology?

Well, docker is both a company and a technology platform. At its core docker is a container runtime. Whatever we have discussed so far was about the container in general and how it works, Docker is an actual implementation of container technology. Docker provides a uniform and standard runtime which provides an environment with the things that an application needs in order to execute. Docker provides a standard which developers can code apps in docker containers on their local machine and can deploy it anywhere they want, it can be literally anywhere say Amazon web services, Microsoft azure, on-premise data center etc etc etc.

As you can see in the picture above, "docker" or in a whole docker engine enables us to do virtualization, I mean OS virtualization alias Containers. 

I am borrowing the definition of docker from docker website,

"Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host. Because of the lightweight nature of containers, which run without the extra load of a hypervisor, you can run more containers on a given hardware combination than if you were using virtual machines"

Does it explain whatever I have explained about container technology? Yeah, you are right docker is platform or framework which provides the ability to enable container technology.

Thanks for reading. See you soon with Docker Architecture.

1 comment:

Unknown said...

Great introduction Vijay. Can't wait to hear a bit more about the nuts and bolts of Docker.

Post a Comment