Skip to content

Implement Docker cleanup module #34

@Sstark97

Description

@Sstark97

Phase 4: Cleanup Modules

Implement Docker/OrbStack cleanup module with safe and aggressive operations.

Implementation

In Infrastructure/Modules/Docker/DockerModule.cs

  • Implements ICleanupModule
  • Supports Docker Desktop and OrbStack
  • Multi-tier cleanup strategy

Features to Port from Bash

Safe Operations

From src/modules/docker.sh:

  1. Remove stopped containers - remove_stopped_containers
  2. Remove dangling images - remove_dangling_docker_images
  3. Prune unused volumes - prune_unused_docker_volumes
  4. Clear build cache - clear_docker_build_cache

Aggressive Operations (require confirmation)

  1. Remove ALL unused images - remove_all_unused_docker_images
  2. Prune unused networks - prune_unused_docker_networks

Deep Cleanup (DESTRUCTIVE)

  1. Reset Docker Desktop data - reset_docker_desktop_data
  2. Cleanup OrbStack data - cleanup_orbstack_data (macOS only)

AnalyzeAsync

  • Check if Docker/OrbStack is available
  • Estimate sizes for each operation
  • Return List<CleanupTarget> with appropriate ConfirmationLevel

CleanAsync

  • Execute operations based on mode
  • Handle confirmations for aggressive operations
  • Use ICommandRunner for docker CLI commands
  • Return List<CleanupResult>

Properties

  • Name: ModuleName.Docker
  • Description: "Clean Docker/OrbStack (containers, images, volumes)"
  • IsDestructive: true (aggressive mode)
  • IsAvailableOnPlatform: true for all (OrbStack only on macOS)

Tests to Port

All in tests/Infrastructure/Modules/Docker/DockerModuleTests.cs

Port tests from bash tests/unit/docker_test.sh and tests/e2e/docker_aggressive_test.sh:

  • Safe operations
  • Aggressive mode confirmations
  • OrbStack detection (macOS only)
  • Docker availability check
  • Size estimation

Definition of Done

  • DockerModule fully implemented
  • All bash tests ported
  • Safe and aggressive modes working
  • OrbStack support on macOS
  • ~5-20GB typical recovery

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions