Virtual Machines vs. Docker Containers¶
Virtual machine¶
Each machine gets its own full guest operating system
Including the kernel. The kernel is like the core of the operating system. The bit that controls the low level stuff.
This is quite resource heavy on the host machine (The computer running the virtual machine)
As a result of this it:
Needs to “boot” the guest Os
Is resource heavy
Hint
You can think of a Virtual Machine as a self contained computer packed into a single file. A hypervisor is capable of running such a file. There are two types of hypervisors:
Type 1: direct interfacing with the infrastructure - e.g. HyperKit (OSX) / HyperV (Win)
Type 2: runs as an application on the host Os - e.g. VirtualBox / VMWare / Parallels Desktop
Containers¶
They all use the host machines kernel
Everything on top of that is still isolated as that makes the distribution unique
All distributions of linux (centos, ubuntu, debian, etc) are all build on the same kernel
Docker uses special features of the unix file system to create isolated environments
A container is a compromise in isolation and sharing
The separation and sandbox-ing is not quite as extreme
As a result of this it:
Uses (much) less resources
Can startup in milliseconds
Take up less disk space
Use less memory