Container Isolation
Container isolation is the set of kernel-enforced boundaries (namespaces, cgroups, capabilities, seccomp, and optionally user namespaces) that limit what a container process can see and do. It is weaker than VM isolation because the kernel is shared.
What isolates a container
Several kernel features work together. Namespaces limit what a process can see (processes, network, mounts, hostname). Cgroups limit what it can consume. Capabilities reduce root's powers, seccomp filters system calls, and Linux security modules such as AppArmor or SELinux add mandatory access control. No single layer is the boundary, and the combination is the protection.
What is and is not isolated
- Isolated: filesystem view, network stack, process list, hostname, and resource usage.
- Not isolated: the kernel itself, kernel vulnerabilities, and the system clock.
Hardening checklist
docker run -d \ --user 1000:1000 \ --cap-drop ALL \ --read-only \ --tmpfs /tmp \ --security-opt no-new-privileges \ --memory=512m --pids-limit=200 \ payment-api:v3.1.0- Run as a non-root user.
- Drop all capabilities and add back only what is needed.
- Use a read-only root filesystem with tmpfs for scratch paths.
- Keep the default seccomp profile, and never use
--privilegedor mount the Docker socket without a strong reason.
When you need stronger isolation
For untrusted code or multi-tenant platforms, use a sandboxed runtime such as gVisor or Kata Containers, or microVMs such as Firecracker.
SecurityA root process that escapes a poorly configured container is root on the host. Reduce the chance with non-root users, dropped capabilities, and default profiles.
Common MistakeTreating a container as a hard multi-tenant boundary for hostile workloads.
Frequently Asked Questions
What does container isolation not protect against?
Kernel-level vulnerabilities and dangerous configuration. Because all containers share one kernel, an exploit through a kernel bug or a privileged container can reach the host and sibling containers.
What are the highest-value hardening steps?
Run as non-root, drop all capabilities and add back only what is required, use a read-only filesystem, keep the default seccomp profile, and avoid privileged mode and Docker socket mounts.
When is a sandboxed runtime worth the cost?
When you run code you do not trust, such as user-submitted programs or multi-tenant workloads. gVisor, Kata Containers, or microVMs add a stronger boundary at some performance or complexity cost.