Interview Prep/Docker/Containers, VMs & Isolation Internals

Are containers secure compared to VMs? What is the main risk?

IntermediateConceptContainers, VMs & Isolation Internals
Answer

The shared kernel is the attack surface: a kernel vulnerability or misconfiguration (privileged, docker.sock mount, host PID/network, dangerous capabilities) can lead to host escape. VMs have a smaller boundary (hypervisor). Mitigations: non-root, dropped capabilities, seccomp/AppArmor, user namespaces, rootless mode, or sandboxed runtimes (gVisor, Kata, Firecracker).

All Docker questions Roadmap: Docker & containers

More on Containers, VMs & Isolation Internals