Application containerization

Application containerization

Let's imagine a developer building an application on his computer and that this application is meant to be deployed on a different machine (production environment). In order to execute properly, this application requires multiple libraries, binaries and packages. For example, a Python program requires the Python interpreter as well as all the imported Python modules.

Thus, if the application is unlikely to run properly in the production environment if it is being deployed by simply copying its source code over.

To run identically as in the development environment, the application requires the same libraries, binaries and packages to be present in the production environment.

Now let's imagine that the production environment is meant to host two applications coming from different development environments. The first application requires version 1 of a specific library while the second requires version 2 of the same library. Deploying both applications by simply copying them alongside their dependencies will likely require in a conflict between the two different versions of the library.

This highlight the need for a way to package applications with all their dependencies so that they can be deployed easily and without conflicting with whatever software is already present in the deployment environment.

A way to achieve this is to use virtual machines (VM). A VM contains its own OS on top of which software can be installed. Thus applications can be installed inside VMs, which are run in parallel on a host machine, allowing those applications to run independantly.

An underlying issue with such approach is that an OS is heavy and slow to boot.

Here, given that the host machine is already provisioned with an OS, having to deploy a new OS for each application is redundant. Technically, only the applications and their respective libraries and binaries need to be packaged so as to run effectively. This is the core concept behind containers. Currently, the most popular tool to work with containers is Docker.

Working with containers ensures that applications will run identically between environments. Additionally, it allows users to run applications without needing to install any dependencies beforehand.