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).
More on Containers, VMs & Isolation Internals
What is a container, in one sentence?BeginnerHow do containers differ from virtual machines?BeginnerCan a Linux container run a Windows application, or the reverse?IntermediateWhat are Linux namespaces? Name the ones Docker uses.BeginnerWhat are cgroups and what do they do for containers?BeginnerWhat is PID 1 in a container and why does it matter?Intermediate