Swarm mode should not be enabled unless necessary

docker

Classification:

compliance

Framework:

cis-docker

Control:

5.1

Description

Swarm mode should be off on a host that takes no part in a swarm.

Rationale

Swarm mode opens management ports and runs the cluster services of Docker, which serve only swarms.

Audit

Show the swarm state of the daemon:

docker info --format '{{ .Swarm.LocalNodeState }}'

Datadog passes the rule when the swarm state is inactive or empty and fails it otherwise. A host that belongs to a swarm by design fails, and needs a manual review.

Remediation

Leave the swarm:

docker swarm leave

Impact

The host stops running swarm services.

Default value

Swarm mode is off.

References

  1. https://docs.docker.com/reference/cli/docker/swarm/leave/