Skip to content

Hardening a container: user, read-only root, capabilities

Select an icon to see what it is.

Step 1 of 6

The default: root, with fewer powers

Unless told otherwise, the container's process runs as user 0, root. It is not the host's full root: Docker removes most capabilities and applies a seccomp filter. But user 0 inside is still user 0 on the host, because user namespaces are not on by default.

$ docker run --rm alpine id
PrevNext

Output inside a default container (shortened)

uid=0(root) gid=0(root) groups=...