docker-disk-cleanup
Skill1 starsChanged 5 months agoMITView on GitHub
Conservative Docker-native disk cleanup for developer machines and local PR-gate hosts. Use when asked to clean Docker disk usage, reclaim Docker image/build-cache/volume space, run daily Docker cleanup, diagnose Docker disk pressure, or safely prune containers, networks, images, BuildKit cache, and unused volumes while preserving active services and gate work.
In this repository15 other files it gives its agents.
- clarify-before-buildSkill
- client-requirements-to-planSkill
- codebase-prune-reviewSkill
- error-logging-instrumentationSkill
- feature-design-preflightSkill
- frontend-design-qualitySkill
- full-app-reviewSkill
- laptop-currency-maintenanceSkill
- nextjs-vercel-analyticsSkill
- pr-production-gateSkill
- repo-technical-documentationSkill
- repo-testing-setupSkill
- security-threat-modelSkill
- test-readiness-preflightSkill
- user-action-coverage-reviewSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 8 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use this skill to reclaim Docker disk space without damaging active local services, test databases, or PR-gate runs.
- Very specific: line 15
Start with an audit: filesystem free space, docker info, docker system df, containers, and volumes.
- Very specific: line 17
Use scripts/docker-disk-cleanup.mjs.
- Very specific: line 19
Do not use sudo.
- Distinctive: line 20
Do not delete named project volumes manually.
- Distinctive: line 22
Do not run overlapping cleanup jobs.
- Distinctive: line 25
Treat Docker race errors such as containers disappearing between list and prune as recheck-and- continue signals unless the script reports …
- Distinctive: line 27
Keep reports sanitized: do not print env values, tokens, auth files, or secret-looking strings.
- Distinctive: line 31
Run a dry run first:
- Distinctive: line 50
When volume risk is unclear:
- Very specific: line 61
Audit first: Run audit or cleanup --dry-run.
- Very specific: line 64
Use --active-gate-mode when a PR gate, test gate, or build is active.
- Distinctive: line 84
Use a report directory under the local agent home, for example:
- Very specific: line 94
Read references/safety-policy.md before changing cleanup behavior, adding new destructive operations, or adapting the skill to a …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Docker Disk Cleanup
Purpose
Use this skill to reclaim Docker disk space without damaging active local services, test databases, or PR-gate runs. Prefer the bundled script over ad hoc prune commands.
Operating Rules
- Start with an audit: filesystem free space,
docker info,docker system df, containers, and volumes. - Use
scripts/docker-disk-cleanup.mjs; do not hand-roll prune order unless the script is missing or cannot run. - Do not use
sudo. - Do not delete named project volumes manually. Let Docker remove only volumes it reports as dangling, after attachment checks.
- Do not run overlapping cleanup jobs. The script uses a lock in the report directory.
- Preserve active services. If gate-like containers are running, or the user says a gate is active, run active-gate mode so image and builder pruning use an age filter.
- Treat Docker race errors such as containers disappearing between list and prune as recheck-and- continue signals unless the script reports a hard failure.
- Keep reports sanitized: do not print env values, tokens, auth files, or secret-looking strings.
Quick Start
Run a dry run first:
node ~/.codex/skills/docker-disk-cleanup/scripts/docker-disk-cleanup.mjs audit
node ~/.codex/skills/docker-disk-cleanup/scripts/docker-disk-cleanup.mjs cleanup --dry-runRun cleanup:
node ~/.codex/skills/docker-disk-cleanup/scripts/docker-disk-cleanup.mjs cleanupFor a known active PR gate or long validation run:
node ~/.codex/skills/docker-disk-cleanup/scripts/docker-disk-cleanup.mjs cleanup --active-gate-modeWhen volume risk is unclear:
node ~/.codex/skills/docker-disk-cleanup/scripts/docker-disk-cleanup.mjs cleanup --skip-volumesWorkflow
- Confirm the target path. Probe the filesystem that actually holds Docker data or the active
workspace. Pass it with
--workspace <path>or setDOCKER_DISK_CLEANUP_WORKSPACE. If unsure, use the current working directory and say so. - Audit first. Run
auditorcleanup --dry-run. Readdocker system dfbefore deciding how aggressive cleanup should be. - Check active work. Inspect running containers and the script's
activeGateModedecision. Use--active-gate-modewhen a PR gate, test gate, or build is active. - Run serialized cleanup. The script plans commands in this order:
docker container prune -fdocker network prune -fdocker image prune -a ... -fdocker builder prune -a ... -f- dangling volume attachment checks
docker volume prune -a -fwhen supported, otherwisedocker volume prune -f- final
docker image prune -a ... -f
- Report the outcome. Include initial/final disk usage, Docker usage, mode, commands run, report path, removed-space summary when Docker provides one, skipped steps, and blockers.
Daily Automation Contract
A daily cleanup automation should run:
node ~/.codex/skills/docker-disk-cleanup/scripts/docker-disk-cleanup.mjs cleanup --workspace <workspace-path>Use a report directory under the local agent home, for example:
--report-dir ~/.codex/automations/daily-docker-cleanupSchedule dry runs first when moving the automation to a new machine.
Safety Policy
Read references/safety-policy.md before changing cleanup behavior, adding new destructive
operations, or adapting the skill to a non-Docker-Desktop host.
The threat model lives in docker-disk-cleanup-threat-model.md; review it before publishing
changes to cleanup behavior, report sinks, or scheduler integration.
Completion Blockers
- Cleanup ran without a prior audit or dry-run-level evidence.
- A second cleanup was launched while one was already running.
- Active gate work was detected but broad image/build-cache pruning ran without an age filter.
- Volumes were deleted manually by name instead of through Docker's unused-volume prune with attachment checks.
- The report omits skipped steps, blockers, or whether active-gate mode was used.
- Secret material or local auth paths were printed in a report or chat response.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

