Incoming container traffic should be bound to a specific host interface

docker

Classification:

compliance

Framework:

cis-docker

Control:

5.14

Description

Containers should publish their ports on a specific host interface.

Rationale

A port published on every interface is reachable from every network of the host, where the service may need one.

Audit

Inspect the containers:

docker ps --quiet | xargs docker inspect --format '{{ .Name }}: Ports={{ .NetworkSettings.Ports }}'

Datadog checks the running containers. It passes the rule when every published port binds a specific host address, and fails it when one binds 0.0.0.0, :: or every address.

Remediation

Publish the port on the address that should serve it:

docker run -p 10.0.0.5:8080:80 <image>

Impact

None.

Default value

Docker publishes ports on every interface of the host.

References

  1. https://docs.docker.com/engine/network/