LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

What are Linux capabilities, and how does Docker use them to make container-root less dangerous?

Capabilities split root's all-or-nothing power into fine-grained units (e.g. CAP_CHOWN, CAP_NET_BIND_SERVICE). Docker drops most of them by default, so a container's root holds only a limited subset — and you can drop or add individual ones.

Historically a process was either root (able to do everything) or not. Capabilities break that monolithic power into discrete privileges a thread or file can hold independently:

  • CAP_CHOWN — change file owner/group (chown).
  • CAP_DAC_OVERRIDE — bypass read/write/execute permission checks.
  • CAP_NET_BIND_SERVICE — bind to ports below 1024.
  • CAP_SYS_MODULE — load kernel modules (the dangerous one from the --privileged escape).
  • CAP_SYS_ADMIN — a very broad grab-bag of admin operations.

By default Docker drops almost all capabilities and adds back only the small set needed to run (you can list them with capsh --print inside a container). This already makes container-root far weaker than host-root. You tune it further with:

  • --cap-drop all then --cap-add chown — the whitelist approach (best practice): start from nothing, add only what the workload genuinely needs.
  • --cap-drop <cap> — remove a specific capability.

Least privilege in action: a web server that only needs to bind a port shouldn't also be able to load kernel modules or rewrite file ownership. Dropping the rest shrinks what an attacker can do after compromising the container.

Root's all-or-nothing power split into fine-grained capabilities; best practice is drop all, then add only what is needed

* Capabilities split root; whitelist only what the workload needs. *

Go deeper:

From Quiz: ISLAB / Docker Security | Updated: Nov 26, 2026