SteelReed

Search

Search posts, questions…

DevOps & CloudQuestion 8 / 35

Junior

How is a container different from a virtual machine?

Short answer

A virtual machine runs its own kernel on a hypervisor; a container is just a process on the host, sharing the kernel, isolated with namespaces and limited with cgroups. Much lighter and faster to start, but weaker isolation.

HardwareHypervisorVM: own kernel + appShared host kernelContainer = processnamespace + cgroup

3 points to say:

  1. VM: own kernel, strong isolation, heavy (GB, tens of seconds to boot); container: MB, starts in milliseconds to seconds.
  2. A kernel vulnerability affects every container on the host; in practice containers run on VMs, and stronger isolation uses a sandbox.
  3. A JVM over the cgroup memory limit gets OOM killed, exit 137 (128 + SIGKILL).

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.