Containerisation is virtualisation at the operating system level, where applications 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 it runs on. All the 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 the memory, processor or disk of the host operating system. This ensures that the processes within the container are isolated.
Containerization VS. Virtualization
There are two basic virtualisation options, or rather two approaches to creating independent, isolated computing environments on the same physical server: virtual machines, which require a hypervisor, and virtual containers. In the first case, each virtual machine uses its own guest operating system, while in the second the kernel of a host operating system is used for all containers. Consequently, the former allows heterogeneous computing environments to be created on a single computer, while the latter allows only homogeneous ones to be created.
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 initialise the application they host. Containers are lighter and are usually 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.
Advantages of Containers
Flexible environment. The biggest advantage of container technologies is that they can be created much faster than virtual machine instances. Their light weight means 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 microservices and can be updated independently without synchronisation issues.
Version management allows you to track container versions, monitor differences between them, etc.
Portability of computing environment. Containers encapsulate all relevant details such as application dependencies and operating systems required to run an application. This makes it easy to port 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.
Standardisation. Most containers are based on open standards and can run on all major Linux distributions, Microsoft, etc.
Security. Containers isolate the processes of one container from another and from the underlying infrastructure. This means that any update or change in one container will not affect the others.
Disadvantages of Containers
Increased complexity: As more containers work with an application, the complexity factor increases. Managing multiple containers in a development environment can be a complex task. Tools such as Kubernetes and Mesos can make it easier to manage large numbers of containers.
In addition, a container is usually packed with many more resources than needed, resulting in a larger image and container size.
Native Linux support: Most container technologies, such as Docker, are based on Linux Containers (LXC). As a result, running these containers in a Microsoft environment is somewhat awkward, and their day-to-day use can be more complicated than running these instances on Linux initially..
OS-level virtualisation. According to Wikipedia, OS-level virtualisation is an operating system paradigm in which the kernel allows the existence of multiple isolated user-space instances. Such instances, called containers, can look like real computers from the point of view of the programs running in them. This approach is useful when you need to set up an operating system park with identical configurations.
Different applications are installed, configured and run in the same way as if they were running on the host OS. The resources allocated to the container are available only to the container.
Container technologies such as LXC, OpenVZ, Linux VServer, BSD Jails and Solaris are used to create OS containers.
Application virtualisation is a technology that encapsulates an application from the underlying operating system on which it runs. It provides access to an application without the need to install it on the target device. The application acts as if it were interacting directly with the original operating system and all the resources it manages, but can be isolated to varying degrees.
Application containers are designed to package and run services as a single process, while OS containers can run multiple services and processes.
Container technologies like Docker and Rocket are examples of application containers.
Want to compare virtual machines and containers in practice? Request a free trial.