Bare Metal, VMs and Containers
Your team has one powerful server and wants to run twenty copies of quicknotes on it, one per customer. You could give each customer a machine, a virtual machine, or a container. The choice decides how much memory you waste, how fast things start, and how strongly customers are separated.
The rule
Bare metal shares nothing, VMs share hardware, containers share the kernel.
- Bare metal. One operating system installed straight on a physical machine. Apps run on it directly. Nothing is shared with other machines, but one machine per workload wastes capacity.
- Virtual machine (VM). A hypervisor slices one physical machine into several pretend machines. Each VM boots its own complete operating system, kernel included. Strong separation, but each copy costs gigabytes of disk and memory and a boot that often takes tens of seconds.
- Container. Processes on one host that all use the host's single kernel, each with its own private view. Megabytes instead of gigabytes, start-up in about a second, but the separation is only as strong as that shared kernel.
| Bare metal | VM | Container | |
|---|---|---|---|
| Kernels | one per machine | one per VM, plus the host | one, shared |
| Typical size | whole machine | gigabytes | megabytes |
| Start-up | minutes to boot | tens of seconds | about a second |
| Isolation | physical | strong | good, thinner |
These layers also stack. Cloud servers are usually VMs, and you run containers inside them. On a Mac or Windows laptop, Docker quietly runs one small Linux VM and puts all your Linux containers inside it.
The shortcut
Count the kernels. More kernels mean stronger walls and more overhead; fewer kernels mean lighter and faster. And a program always needs the kernel type it was built for.
As twenty VMs
Twenty guest kernels plus the host's: twenty-one kernels. Twenty full operating systems to patch, boot and store.
The trap is assuming containers are always better. When you need a different kernel, or very strong walls between parties who do not trust each other, a VM is the right tool.
Drills
Answer fast — trust the rule.
Ten containers run on one Linux server. How many kernels are in use?
Why does a container usually start much faster than a VM?
You must run a Windows-only program on a Linux host. What do you need?
Docker Desktop on a Mac runs Linux containers. How?
Remember
- Bare metal shares nothing, VMs share hardware, containers share the kernel.
- Shortcut: count the kernels. More kernels, stronger walls, more overhead.
- Trap: a program needs its own kernel type, so a Windows app on a Linux host needs a VM, not a container.
