Containerization is virtualization at OS level, through which applications are run in isolated user spaces called containers, all using the same shared operating system. The container is independent of the resources or architecture of the host on which it runs. All components needed to run an application are packaged as a single image. The application in the container runs in an isolated environment and does not use memory, processor, or disk of the host operating system. This ensures that the processes inside the container are isolated.
What Differentiates Containerization from Virtualization?
There are two basic virtualization options or rather two approaches to creating independent isolated computing environments on the same physical server: virtual machines that need a hypervisor and virtual containers. In the first case, each virtual machine uses its guest OS, while in the second one, the kernel of one host OS is used for all containers. Accordingly, the first allows to create heterogeneous computing environments on one computer, the second allows creating only homogeneous ones.
However, since virtual machines include an operating system, their size can reach several gigabytes. Another disadvantage of virtual machines is that it takes a relatively long time to boot the operating system and initialize the application they host. Containers are lighter and are mostly measured in megabytes. Unlike virtual machines, containers can run almost instantly. When choosing between containers and virtual machines, you should consider the goals you need to achieve.
Flexible environment. The biggest advantage of container technologies is that they can be created much faster than virtual machine instances. Their light weight provides less overhead in terms of performance and size.
Improved performance. Containers increase developer productivity by eliminating network dependencies and conflicts. Each container can be treated as a separate microservice and therefore can be independently updated without any synchronization problems.
Version management allows you to monitor container versions, monitor differences between them, etc.
Portability of the computing environment. Containers encapsulate all relevant details, such as application dependencies and operating systems needed to run an application. This facilitates the portability of the container image from one environment to another. For example, you can use the same image to run in a Windows/Linux or dev/test/stage environment.
Standardization. Most containers are based on open standards and can work in all major Linux distributions, Microsoft, etc.
Security. Containers isolate the processes of one container from another, as well as from the basic infrastructure. Thus, any update or change in one container does not affect the others.
Increased complexity: with more containers working with an application, the complexity factor increases. Managing multiple containers can be a complex task in a development environment. Tools such as Kubernetes and Mesos can make it easier to manage large numbers of containers.
Besides, a container is usually packed with a lot more resources than needed, resulting in a larger image and a larger container size.
Native Linux support: Most container technologies such as Docker are based on Linux containers (LXC). Therefore, running these containers in a Microsoft environment is a bit awkward and their daily use can be more complicated than running these instances on Linux initially.
Virtualization at the OS level. According to Wikipedia, OS-level virtualization is an operating system paradigm in which the kernel allows the existence of multiple isolated user-space instances. Such instances, called containers may look like real computers from the point of view of programs running in them. This approach is helpful when you need to configure an operating system park with identical configurations.
Different applications are installed, configured, and executed in the same way as if the application is running on the host OS. The resources assigned to the container are only available to the container.
Container technology such as LXC, OpenVZ, Linux VServer, BSD Jails, and Solaris are used to create OS containers.
Application virtualization is a technology that encapsulates an application from the underlying operating system on which it is executed. It enables access to an application without needing to install it on the target device. The application works as if it is directly interacting with the original operating system and all the resources it manages, but can be isolated to varying degrees.
Application containers are designed to pack and run services as a single process, while OS containers can run multiple services and processes.
Container technologies such as Docker and Rocket are examples of application containers.
Do you want to compare virtual machines and containers in practice? Request free trial access.