Short answer is “Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.”
But chances are that you already knew that. Of course, if you are reading this, you need a little more information that. Before we can jump into Docker, lets understand why we need container. The meme above kind of summarises the need for container in a very light hearted way.
Why do we need containers?
As application grow, they needed a consistent way to scale into multiple computers which are exactly alike so that they behave exactly the same. We can of course do it manually, provisioning new machine, installing all softwares and making sure that they are alike and then commission them in production. How much time do you think that would take? typically anywhere in range of few days to a few months.
As applications like google, facebook, linked in grew they all needed to scale fast and could not afford manual scaling.
The traditional physical machine has three layers, the physical layer which is hardware, which supports Operating System and then you can run your applications like nodeJS or Tomcat or Python on top of it.
Virtualisation has been around in some form of other for a very long time, initially it was to support multi user systems, each user gets their own application space and file space. In 2000 the full virtualisation came into picture where you could run a complete operating system over another operating system. The virtualised environment would look something like this.
In a virtualised architecture, the virtual machine software like virtualbox would run a complete guest operating system over an existing host operating system, So if you are running windows as host operating system and you need Linux, then your machine should be capable of running Windows and Linux and VM and your application. This solution works but doesn’t work, it is wasting way too much of computing power running operating system which no one needs. There has to be a better way to deal with this.
Containers take a very different approach to this problem, the waste in virtual architecture is multiple operating system, how about if we stick to only one operating system shared between host and guest. You can think of containers working in this way. Lets take a look at how containers look in our diagram.
In this case we have two containers running on host operating system, one running Tomcat and one running NodeJS. Containers are very lightweight software which provide the virtual separation to each of the process running inside a host operating system. Very similar to two person logged into a same linux server running separate softwares, in fact the early version of Docker was based on the linux library which provided that feature.
Every design choice comes with a compromise.
Since linux is the only operating system which supports multi user, containers can run only on linux. Last I checked there were some attempts to make containers run on Windows without virtual machine, so its possible that in some time, it would be possible.
Since the host operating system is shared, you can not run .NET based app having dependency on Windows component, on Docker containers running Linux.