Application containerization is a method used to deploy and run distributed applications without launching an entire virtual machine (VM) for each application. Let’s get into this in more detail, however it is equally necessary to understand how virtualization alone helps and then we shall have a comparison with containerization to have this elaborated in detail as followed.
Virtual machine is a computer file, typically called an image, which behaves like an actual computer. In other words, creating a computer within a computer. The virtual machine is comprised of a set of specification and configuration files and is backed by the physical resources of a host. Each virtual machine provides its own virtual hardware, including CPUs, memory, hard drives, network interfaces and other devices.
In a virtual machine(as illustrated in Figure 1), valuable resources are emulated for the guest OS and Hypervisor, which makes it possible to run many instances of one or more operating systems in parallel on a single machine (or host). Every guest OS runs as an individual entity from the host system. However, there is a mandatory Guest OS which will handle each VM with its own virtual hardware which are in-turn shared from the host OS. While this helps in many scenarios, there are cases where there is no such need of sharing the complete resource-set along with respective Operating Systems when applications are single OS compatible. But to achieve this there should be provision to hold the application level isolation albeit sharing all the other virtual hardware. Containerization is the one which makes this possible with the help of Docker. Let’s get into to that now and see how this is achieved via Docker and Containerization.
What is Docker?
According to a Linux.com article, Docker is a tool that can package an application and its dependencies in a virtual container that can run on any Linux server. This helps enable flexibility and portability on where the application can run, whether on premises, public cloud, private cloud, bare metal, etc.
In a nutshell, Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. Each container can run a whole web application or a service, as shown in Figure 2.
Containerization provides many of the benefits of loading an application onto a virtual machine, as the application can be run on any suitable physical machine without any worries about dependencies. Containerization has gained recent prominence with the open-source Docker. Docker containers are designed to run on everything from physical computers to virtual machines, bare-metal servers, OpenStack cloud clusters, public instances and more. These are made available with some ready-made images which we will try to understand in the next section.
A Docker Image is the template (application plus required binaries and libraries) needed to build a running Docker Container (the running instance of that image). Using an object-oriented programming analogy, the difference between a Docker image and a Docker container is the same as that of the difference between a class and an object. An object is the runtime instance of a class. Similarly, a container is the runtime instance of an image. As templates, images are what can be used to share a containerized applications. Collections of images are stored/shared in registries like Docker Hub.
CoreOS recently released a streamlined alternative to Docker called Rocket. And Canonical, developers of the Ubuntu Linux-based operating system, has announced the LXD containerization engine for Ubuntu, which will also be integrated with OpenStack.
Microsoft is working on its own containerization technology called Drawbridge, which will likely be featured in Windows Server and Azure in the future. And Spoon is another Windows alternative that will enabled containerized applications to be run on any Windows machine that has Spoon installed, regardless of the underlying infrastructure.
Lastly, Docker may have been the first to bring attention to containerization, but it’s no longer the only container system option. It is always a need basis decision switch between Virtualization and Containerization per criteria.