In a simple way, we can say a container is nothing more than a single isolated process running in the host Operating System.
It consumes only the resources that the app consumes and without the overhead of any additional processes.
I know everyone is curious to know how the container is better than a Virtual Machine (VM). Below lines will explain what makes a container special.
Containers are light weight, which allows user to run applications in large number on the same hardware but in case of VM, its needs to run its own set of system processes, which requires additional compute resources in addition to those consumed by the component’s own process.
Because of the overhead of VMs, you often end up grouping multiple applications into each VM because you don’t have enough resources to dedicate a whole VM to each app. When using containers, you can have one container for each application.
Application Running in three VM
When you run three VMs on a host, you have three completely separate operating system running on and sharing the same bare-metal hardware. Underneath those VMs is the host’s OS and a hypervisor, which divides the physical hardware resources into smaller sets of virtual resources that can be used by the operating system inside each VM. Applications running inside those VMs perform system calls to the guest OS’ kernel in the VM, and the kernel then performs x86 instructions on the host’s physical CPU through the hypervisor.
Applications Running In Container
Containers, all perform system calls on the exact same kernel running in the host OS. This single kernel is the only one performing x86 instructions on the host’s CPU. The CPU doesn’t need to do any kind of virtualization the way it does with VMs.