Virtual Machine vs Container

Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers. It functions as a virtual computer system with its own CPU, memory, network interface, and storage, created on a physical hardware system. Software called the hypervisor allows multiple VMs to run on a single machine. 

In the VM world, the operating system actually running on your computer is called the host and any operating systems running inside VMs are called guests. 

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. Containers are exceptionally “light”—they are only megabytes in size and take just seconds to start.

Each VM includes a full copy of an operating system, the application, necessary binaries and libraries – taking up tens of GBs. VMs can also be slow to boot.

VM: 

  • Different VM, different operating systems are possible. like windows, linux etc.
  • Higher disk space as each VM is heavy 
  • Bootup time is more, as it needs to boot the entire OS
  • More isolation between different VM

Container:

  • Containers share a common operating
  • Light in size, as there is no guest OS
  • Bootup time is faster
  • Less isolation as underlying kernel is shared bw different containers

What is Docker Engine here:

Docker is a set of platform as a service (PaaS) products that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.

The software that hosts the containers is called Docker Engine.

It was first started in 2013 and is developed by Docker, Inc.

Conclusion

Virtual machines and containers differ in several ways, but the primary difference is that containers provide a way to virtualize an OS so that multiple workloads can run on a single OS instance, where with VMs, the hardware is being virtualized to run multiple OS instances. Containers’ speed, agility, and portability make them yet another tool to help streamline software development.