Course contentsShow
← Security
Lesson 1627 of 3,05233. Container SecurityFree lesson

Privileged Containers and Capabilities

Understanding the risks of privileged mode and excessive Linux capabilities in containers.

Privileged Containers and Capabilities

What you'll learn: How running containers in privileged mode or granting excessive Linux capabilities undermines isolation and creates severe security risks.

The Danger of Privileged Mode

A privileged container runs with almost all the permissions of the host system. When you launch a container with the --privileged flag, you're essentially removing the safety barriers that make containers secure. This grants the container:

  • Full access to all host devices (/dev/)
  • Nearly all Linux capabilities
  • Ability to load kernel modules
  • Access to bypass security restrictions

Think of it like giving a guest in your home not just a bedroom key, but also keys to your safe, car, and office. They're no longer just a guest—they have almost the same access you do.

Linux Capabilities: Precision Privileges

Instead of all-or-nothing privileged mode, Linux capabilities break root privileges into discrete units. Examples include:

  • CAP_NET_ADMIN - configure network interfaces
  • CAP_SYS_ADMIN - powerful system administration operations
  • CAP_SYS_MODULE - load/unload kernel modules
  • CAP_DAC_OVERRIDE - bypass file permission checks

By default, containers run with a restricted capability set. However, administrators sometimes grant excessive capabilities without understanding the risk. Even a single dangerous capability like CAP_SYS_ADMIN can enable container escape.

Why This Matters

Privileged containers and excessive capabilities essentially nullify container isolation. An attacker who compromises a privileged container gains nearly root-level access to the host system—defeating the entire security model. They can:

  • Access sensitive host files and processes
  • Manipulate other containers
  • Pivot to the underlying infrastructure
  • Install persistent backdoors on the host

Key Takeaway: Never run containers in privileged mode in production unless absolutely necessary; grant only the minimum required capabilities, and treat any privileged container as if it were the host itself—because security-wise, it practically is.