Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Introduction  ›  Lesson

Bare Metal, VMs and Containers

Bare Metal vs VMs vs Containers 14 minBare metal runs one operating system on the hardware, virtual machines each bring their own kernel on shared hardware, and containers share the host's kernel, trading some isolation for speed and density.

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.

Twenty quicknotes copies on one serverStep 1 of 3
  1. 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.

quick drill

Ten containers run on one Linux server. How many kernels are in use?

quick drill

Why does a container usually start much faster than a VM?

quick drill

You must run a Windows-only program on a Linux host. What do you need?

quick drill

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.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainPick the right isolation

You must run twenty copies of quicknotes plus one old Windows-only reporting tool on a single Linux server. Explain what you would use for each and why, using the idea of counting kernels.