For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/default_rules/9h8-wne-ybj.md. A documentation index is available at /llms.txt.

Containers should not share the host's user namespaces

docker

Classification:

compliance

Framework:

cis-docker

Control:

5.31

Description

Containers should run in the user namespace that Docker gives them, without --userns=host.

Rationale

With user namespace remapping, root in a container is unprivileged on the host. A container in the host user namespace undoes that, and its root is root on the host.

Audit

Inspect the containers:

docker ps --quiet --all | xargs docker inspect --format '{{ .Name }}: UsernsMode={{ .HostConfig.UsernsMode }}'

Datadog passes the rule when a container’s user namespace mode is other than host and fails it otherwise.

Remediation

Run the container without --userns=host.

Impact

None.

Default value

Containers run in the user namespace that Docker gives them.

References

  1. https://docs.docker.com/engine/security/userns-remap/
  2. https://docs.docker.com/reference/cli/docker/container/run/#options