Skip to content

feat(docker): add aggressive cleanup mode#22

Merged
Sstark97 merged 2 commits intomainfrom
feature/issue-12-docker-aggressive
Feb 3, 2026
Merged

feat(docker): add aggressive cleanup mode#22
Sstark97 merged 2 commits intomainfrom
feature/issue-12-docker-aggressive

Conversation

@Sstark97
Copy link
Owner

@Sstark97 Sstark97 commented Feb 3, 2026

Summary

Adds two new aggressive Docker cleanup operations that go beyond the standard dangling-only pruning, reclaiming significantly more disk space from old/unused Docker resources.

New operations

  • remove_all_unused_docker_images — runs docker image prune -a, removing ALL images not referenced by any container (not just dangling/untagged). Useful for cleaning up images from old projects you no longer run.
  • prune_unused_docker_networks — runs docker network prune, removing custom networks not attached to any container. Preserves default bridge, host, and none networks.

Safety design

  • Both operations require explicit confirmation via confirm_dangerous (user must type yes)
  • Only offered interactively — skipped entirely when --force is used, keeping force mode limited to safe cleanup
  • Fully integrated with --dry-run (shows what would happen) and --analyze (collects size estimates in preview)
  • Positioned in the cleanup flow between safe cleanup and the existing Docker Desktop reset option

Cleanup flow (updated)

  1. Safe cleanup: stopped containers, dangling images, unused volumes, build cache (automatic)
  2. Aggressive: all unused images (asks, requires typing yes)
  3. Aggressive: unused networks (asks, requires typing yes)
  4. Docker Desktop complete reset (asks, existing)
  5. OrbStack cleanup (asks, existing)

Tests

3 new unit tests added, all 129 tests passing (118 unit + 11 e2e).

Closes #12

Sstark97 and others added 2 commits February 3, 2026 21:43
Add two new cleanup operations beyond standard dangling-only pruning:

- remove_all_unused_docker_images: prunes ALL images not referenced by
  any container (docker image prune -a), not just dangling/untagged ones.

- prune_unused_docker_networks: removes custom networks not in use,
  preserving default bridge/host/none networks.

Both require explicit confirmation (confirm_dangerous). Only offered
interactively — skipped when --force is used. Integrated with --analyze
and --dry-run.

3 new unit tests added.

Closes #12

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
11 tests covering images, networks, dry-run, analyze mode, and
full workflow. Uses isolated devsweep-e2e-* prefix for all resources.
Closes #12
@Sstark97 Sstark97 merged commit 428c025 into main Feb 3, 2026
2 checks passed
@Sstark97 Sstark97 deleted the feature/issue-12-docker-aggressive branch February 3, 2026 21:56
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.

Add aggressive Docker cleanup mode

1 participant