Have you worked with a Virtual Machine? Probably, yes! Have you worked with a container? It is still possible, but maybe you are a bit new to containers. This is all good! Even they have few similarites, they have much differences and pros/cons. Let’s check these!
Virtual Machines (VM) run on hypervisors and hypervisor software virtualizes the physical hardware resources and allocates them to virtual machines as virtual resources.
Even this technology works pretty well, it has quite important drawbacks. Each VM runs a full copy of an operating system. It means that each VM must be managed. Also, they are heavy to migrate, hard to manage and takes time on boot process.
They need maintenance and they are hypervisor dependent. For example, ESXi based machines cannot be moved to Hyper-V host seamlessly.
On the other hand, we have containers. Containers run on a supported operating system and managed by container engines. Technically there is no specific resource virtualization needed.
Containers are isolated using Linux processes, cgroups. namespaces and filesystem.
Container engine is a process to manage the lifecycle of a container.
Containers runs a minimal version of the necessary operating system processes within the container. Also, all of the required frameworks and libraries are included in the container image. This makes them portable and easy to scale.
Virtual Machine vs Container
|Virtual Machines||– Good Community Know How|
– Mature Technology
– Ideal for Most Applications
|– License for Each VM|
– VM Specific Management
– Heavy to Migrate
– Long Deployment Time
– Boot Process Takes Time
|Container||– Easy to Deploy and Migrate|
– Lightweight Images
– Single Underlay Operating System
|– Learning Curve|
– Complex App Packaging
– Container Engine Management