Files
computer-playbook/roles/sys-ctl-hlth-docker-volumes
Kevin Veen-Birkenbach 5e550ce3a3 sys-ctl-rpr-docker-soft: switch to STRICT label mode and adapt tests
- script.py now resolves docker-compose project and working_dir strictly from container labels
- removed container-name fallback logic
- adjusted sys-ctl-hlth-docker-container to include sys-ctl-rpr-docker-soft
- cleaned up sys-svc-docker dependencies
- updated unit tests to mock docker inspect and os.path.isfile for STRICT mode

Conversation: https://chatgpt.com/share/68b80927-b800-800f-a909-0fe8d110fd0e
2025-09-03 11:24:14 +02:00
..

Docker Volumes Health Check

Description

This role detects unused anonymous Docker volumes that are not bound to any running container.
It can optionally exclude specific volumes from the check using a configurable whitelist.

Overview

The role installs a script and a systemd service with a timer to periodically scan for leftover anonymous volumes.
This helps prevent wasted disk space and leftover resources from old deployments.

Purpose

The main purpose of this role is to keep Docker environments clean by identifying and reporting orphaned anonymous volumes.
It supports a whitelist mechanism to avoid alerting on known or intentional volumes.

Features

  • Anonymous Volume Detection: Identifies volumes with 64-character IDs not attached to any container.
  • Whitelist Support: Skips volumes listed in DOCKER_WHITELISTET_ANON_VOLUMES.
  • Bootstrap Volume Exclusion: Ignores known bootstrap volumes (e.g., /var/www/bootstrap).
  • Systemd Integration: Installs a one-shot service and timer to automate checks.
  • Alerting Support: Works with the sys-ctl-alm-compose role for failure notifications.

Further Resources