Skip to content

feat(clean): add opt-in Docker unused data pruning#554

Merged
tw93 merged 2 commits intotw93:mainfrom
MohammedTarigg:feat/opt-in-docker-prune
Mar 10, 2026
Merged

feat(clean): add opt-in Docker unused data pruning#554
tw93 merged 2 commits intotw93:mainfrom
MohammedTarigg:feat/opt-in-docker-prune

Conversation

@MohammedTarigg
Copy link
Copy Markdown
Contributor

Summary

This PR adds opt-in Docker cleanup to mo clean.

  1. Adds a --docker flag for explicit Docker pruning.
  2. Keeps default mo clean behavior safe by skipping Docker unused data unless the flag is set.
  3. Updates help/docs and adds tests for opt-in, daemon-down, and active prune paths.

Related: local storage audit follow-up

Scope

  • In scope: opt-in pruning of unused Docker images, stopped containers, unused networks, and anonymous volumes during mo clean.
  • Out of scope: automatic Docker pruning in default clean runs, interactive prompts, or broader Docker UX changes.
  • Platform scope: macOS with Docker CLI/Desktop available.

Why This Approach

  • Docker data can be large, but pruning images and volumes can remove local dev state users still expect to keep.
  • An explicit --docker flag keeps the default cleanup flow conservative while still making the reclaim path easy to discover and script.
  • This uses docker system prune -af --volumes because it matches the reclaimable buckets users see in docker system df better than docker builder prune alone.

Validation

  • bash -n bin/clean.sh lib/core/help.sh lib/clean/dev.sh mole tests/clean_dev_caches.bats
  • bats tests/clean_dev_caches.bats
  • Local manual validation:
    • docker system df
    • docker system prune -a --volumes -f

Notes

  • Default mo clean now prints a clear skip message for Docker unused data and points users to --docker.
  • On my local machine, Docker Desktop data dropped from about 15G to 1.2G after prune, and free disk increased from 53Gi to 67Gi.

@tw93 tw93 self-requested a review as a code owner March 10, 2026 08:18
@tw93 tw93 merged commit 65b0db4 into tw93:main Mar 10, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants