Skip to content
Optimal Lab

DevOps · interactive

Containers vs virtual machines

Both run your app on someone else's hardware. A container shares the host kernel. A virtual machine boots a second operating system.

Press Start both to launch the same app each way, side by side.

Container

stopped

shares the host kernel

  1. 1

    An image is a stack of file layers, plus a command to run.

    Layers here: base files, libraries, your app. No second operating system.

  2. 2

  3. 3

  4. 4

  5. 5

In production this takes about a second.

Virtual machine

stopped

boots its own operating system

  1. 1

    The hypervisor reserves CPU, memory, and a virtual disk.

    This is a computer made of software, sitting on the real one.

  2. 2

  3. 3

  4. 4

  5. 5

In production this takes tens of seconds to minutes.