Mount propagation mode should always be set to a non-shared option

docker

Classification:

compliance

Framework:

cis-docker

Control:

5.20

Description

Volumes should mount with private or slave propagation.

Rationale

With shared propagation, the mounts a container makes inside a volume appear on the host and in other containers.

Audit

Inspect the containers:

docker ps --quiet --all | xargs docker inspect --format '{{ .Name }}: Propagation={{range $mnt := .Mounts}} {{json $mnt.Propagation}} {{end}}'

Datadog passes the rule when no mount of a container uses shared or rshared propagation, and fails it otherwise.

Remediation

Mount the volumes with private propagation, the default, or slave where the container must see the mounts of the host.

Impact

None.

Default value

Mounts use rprivate propagation.

References

  1. https://docs.docker.com/engine/storage/bind-mounts/#configure-bind-propagation
  2. https://docs.docker.com/engine/containers/run/#volume-shared-filesystems