Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Linux Capabilities · Container Security

Direct answer

Linux capabilities split root's powers into units like NET_ADMIN or SYS_ADMIN. Containers should drop all capabilities and add back only what they need, and never run privileged.

When to use this

Use this when limiting root powers inside containers.

First 30 seconds

1. Drop all capabilities and add only needed ones.

2. Avoid CAP_SYS_ADMIN, NET_ADMIN, SYS_PTRACE.

3. No privileged containers.

4. allowPrivilegeEscalation: false.

5. Enforced by restricted PSA.

Operational verification

container → capability set → kernel operations

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Running with Docker's default capability set when far fewer are needed.
  • --cap-add=ALL or privileged: true to fix permission errors.
  • Forgetting allowPrivilegeEscalation: false and no-new-privileges.
  • Assuming non-root user means no capabilities — file capabilities on binaries can still grant them.
Platform / version applicability
Platform and workload security
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformPlatform and workload security
Scope / prerequisiteUse this when limiting root powers inside containers.
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Capabilities split root into units like NET_ADMIN.
  • Drop ALL and add back only what is needed.
  • Never run --privileged in production.
Key checks
  • docker inspect <c> --format '{{.HostConfig.CapAdd}} {{.HostConfig.CapDrop}}' — capabilities
  • kubectl get pod <p> -o jsonpath='{..securityContext.capabilities}' — pod caps
  • capsh --decode=<hex> — decode CapEff
ReferenceWhy it matters1 section · depth on demand

Dropping capabilities

docker run --cap-drop ALL --cap-add NET_BIND_SERVICE nginx

Kubernetes:

securityContext:
  capabilities:
    drop: ["ALL"]
    add: ["NET_BIND_SERVICE"]
  allowPrivilegeEscalation: false

Documented example, not captured output. Never run --privileged or add SYS_ADMIN without a strong reason; together with host mounts they allow container escape.

ReferenceHow it works1 section · depth on demand

In depth

Linux capabilities in containers determine which root-like privileges a container process has. Container runtimes drop many capabilities by default but still grant some (e.g. CHOWN, NET_BIND_SERVICE, SETUID); the safest approach is to drop all and add back only what is needed.

securityContext:
  runAsNonRoot: true
  allowPrivilegeEscalation: false
  capabilities:
    drop: ["ALL"]
    add: ["NET_BIND_SERVICE"]
docker run --cap-drop ALL --cap-add NET_BIND_SERVICE nginx

Never grant SYS_ADMIN, NET_ADMIN or SYS_PTRACE without a strong reason — and avoid privileged: true, which grants all capabilities and device access, effectively removing container isolation. The Kubernetes "restricted" Pod Security Standard enforces these rules.

ReferenceConfiguration & state1 section · depth on demand

Commands

docker run --cap-drop=ALL --cap-add=NET_BIND_SERVICE nginx
# Kubernetes
securityContext:
  capabilities:
    drop: ["ALL"]
    add: ["NET_BIND_SERVICE"]

Documented example, not captured output. Check a running process with grep Cap /proc/<pid>/status and decode with capsh --decode=<hex>. Never add SYS_ADMIN unless there is no other way — it is close to root.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docPlatform and workload security current

Authoritative/upstream documentation reviewed for bounded claims in Container Security → Linux Capabilities. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://csrc.nist.gov/pubs/sp/800/190/final · confidence 94%
Confirmation

Confirm action

Continue?