Docker
TMA-DOCKER-6.2
Ensure that container sprawl is avoided
LowLevel 1Manual reviewdocker
Description
Large numbers of stopped containers waste resources and hide stale, unpatched workloads. Whether the count is excessive is a site decision, so this is a manual review.
How it is checked
Audit method: Manual review
This recommendation cannot be checked automatically. A scan lists it with these instructions when you pass --include-manual.
Review container sprawl: compare docker info --format '{{ .ContainersStopped }}' with docker info --format '{{ .ContainersRunning }}', list stopped containers with docker ps -a --filter status=exited and remove the ones no longer needed.
How it is fixed
Fix method: Guidance or infrastructure patch
Remove unused containers: docker container prune (or docker rm <id> for specific containers) after confirming they are not needed.
Properties
- Operating systems
- Any
- Tags
- dockeroperations
- Reference
- CIS Docker Benchmark v1.9.0 - 6.2 Ensure that container sprawl is avoided