FoundationDocker

What is a container, and how is it different from a virtual machine?

What they are really testing: Whether you understand that containers share the host kernel and isolate processes, while VMs virtualize hardware with their own kernel. The trade-off (density/speed vs isolation) is the real test.

A real interview question

What is a container, and how is it different from a virtual machine?

What most people say

drag me

A container is like a lightweight virtual machine that runs your app.

The "lightweight VM" analogy hides the key fact: a container shares the host kernel and is really an isolated process, not a virtualized machine. That difference drives the isolation and security trade-off.

The follow-ups they ask next

  • If containers are lighter, why do cloud providers still run them inside VMs?

    For the stronger isolation boundary: a shared kernel means a kernel exploit could cross containers, so multi-tenant platforms put containers in VMs (or microVMs like Firecracker) to get hardware-level isolation between tenants.

  • What does "sharing the host kernel" mean for a container OS?

    The container brings its own user space (libraries, binaries) but uses the host kernel, so a Linux container needs a Linux kernel. You cannot run a different kernel; only the user-space distro differs.

What the interviewer is listening for

  • Knows containers share the host kernel
  • Knows VMs have their own kernel/hypervisor
  • Articulates the isolation vs density trade-off

What sinks the answer

  • "A container is a lightweight VM"
  • Thinks a container has its own kernel
  • No grasp of the isolation difference

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

A container [packages an app and runs as an isolated process sharing the host kernel]. A VM [runs a full guest OS with its own kernel on a hypervisor]. So containers are [light and start in ms], VMs are [heavier but give a stronger isolation boundary]. The trade-off is [density/speed vs isolation], and they [often compose, containers inside VMs].

Keep going with docker

All 336 cloud engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free