Overview Of Docker

Docker

Docker is a very popular topic nowadays, a lot of good documents are available online but many of them talk about Linux kernel, UnionFS, lxc etc., scaring many of us who are not aware of these terms.

In this article, I will try to cover,

  • What is Docker?
  • Why is it needed?
  • How does it really work under the hood?

What is Docker?

Docker is all about running a single program inside separated environments. It is an open source platform with can be used to package, distribute and run applications in different environments.

Let start understanding by an example,

We have a Villa “Dock” which we have given to a company who allows their employees to stay on a temporary basis and charge a fee for it. 

Overview Of Docker

In this villa, we have three rooms.

Overview Of Docker

As the above shows, we have three rooms for our employees in “Dock Villa”. However all of the of the three rooms do not have common facilities & everyone has to share the common space. This creates issues, I would personally not like to share.

Now, compare the same as from a computer perspective, our computer does the same thing, I am not going to replace rooms with application & common facilities with Libraries/ frameworks.

Overview Of Docker

Let us assume we have an XYZ framework installed and our all apps use the same framework, everything seems to be perfect, right?  However, what will happen if our app 1 needs v1.0, app 2 needs v2.0 and app 3 needs v3.0 of our xyz framework while our framework installed is v2.0? As a result, only App 2 will work.

Overview Of Docker

Applications 1 & 3 will stop working because they need a different version to run. What can be done now?

One way is to use three different systems for all three applications, but it will be very expensive and maintenance will also be very difficult.

Now, “DOCKER” comes into the picture.  Take a second and go back to our old Docker Villa problem. What Docker will do is, Docker will  make sure that each room has its own facilities instead of common facilities & will remove the common facilities resulting in something like below

Overview Of Docker

It's the same for a computer, Docker will do something like this.
 
Overview Of Docker

So like this, Docker will create a package that can run in different environments.

Why it is needed & how does it really work?

Let us take a modern web application

Overview Of Docker

In this web app, we have something like a database SQL that has its own configuration, a search tool integration, a reverse proxy like Nginx, a front end framework and some other integrations. All of them have a lot of configurations, and a dependencies library that make them work together, all of these have to we well synced with each other on various environments.

Overview Of Docker

Each of the environments won’t need all the components. How can we replicate all configurations, how can we make sure it works locally? What we can do is we can package it all in a virtual machine, similar to the production environment, but running an application inside virtual machine means running an entire operating system on top of the existing one.

Overview Of Docker

Docker is a tool that takes container approach one step further by creating safe and easy to use interfaces for running containers. On a piece of hardware we run a host Operating system, above that we run Docker Engine that provides access to the resources of the host operating system. Our images now are able to use these resources through Docker engine.

Overview Of Docker

In both, the app environment is built on the top, with VM we need to fully boot the guest operating system to run our app, while Docker uses the system which is already running. So instead of minutes in VM we boot in milliseconds in Docker.


Similar Articles