docker-sweep

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: MIT

README ΒΆ

docker-sweep 🧹

Interactively reclaim Docker disk space β€” see exactly what you're deleting before you delete it.

docker system prune is a blunt axe. It deletes everything with no preview.
docker-sweep shows you every reclaimable resource β€” images, stopped containers, unused volumes, build cache β€” grouped by project, sorted by size, with ages shown. You pick exactly what to delete.


The Problem

Error response from daemon: no space left on device

Every Docker user hits this. Your options today are:

  • docker system prune β€” nukes everything, no preview, no selection
  • docker rmi / docker rm / docker volume rm β€” manual, tedious, no size overview
  • Docker Desktop's "Clean Up" β€” only available in the paid GUI

docker-sweep fills that gap.


Demo

╔══════════════════════════════════════════════════════════════╗
β•‘  docker-sweep   14.2 GB reclaimable                         β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘                                                              β•‘
β•‘  β–Ό IMAGES  (3 items β€’ 1.8 GB)                               β•‘
β•‘                                                              β•‘
β•‘  [βœ“] node:18                   980.0 MB   41d ago  dangling β•‘
β•‘  [ ] app-backend:latest      420.0 MB   122d ago  unused   β•‘
β•‘  [βœ“] postgres:13               380.0 MB   90d ago  dangling β•‘
β•‘                                                              β•‘
β•‘  β–Ό CONTAINERS  (2 items β€’ 45 MB)                            β•‘
β•‘                                                              β•‘
β•‘  [ ] app_web_1               32.0 MB    5d ago   exited   β•‘
β•‘  [ ] redis_test                13.0 MB    2d ago   exited   β•‘
β•‘                                                              β•‘
β•‘  β–Ό VOLUMES  (1 item β€’ 2.1 GB)                               β•‘
β•‘                                                              β•‘
β•‘  [βœ“] myapp_pgdata              2.1 GB     30d ago  local    β•‘
β•‘                                                              β•‘
β•‘  β–Ό BUILD CACHE  (847 layers β€’ 8.3 GB)                       β•‘
β•‘                                                              β•‘
β•‘  [ ] regular                    8.3 GB    various           β•‘
β•‘                                                              β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘  Selected: 3 items  3.5 GB                                  β•‘
β•‘  [↑/↓] navigate  [SPACE] select  [A] all  [D] delete  [Q] quit
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Install

Homebrew (macOS / Linux)
brew install advayaflow/tap/docker-sweep
Go install
go install github.com/advayaflow/docker-sweep/cmd/docker-sweep@latest
Download binary

Grab the latest binary for your platform from Releases:

Platform Binary
Linux (amd64) docker-sweep-linux-amd64
Linux (arm64) docker-sweep-linux-arm64
macOS (Intel) docker-sweep-darwin-amd64
macOS (Apple Silicon) docker-sweep-darwin-arm64
Windows docker-sweep-windows-amd64.exe
Docker (no install needed)
docker run --rm -it \
  -v /var/run/docker.sock:/var/run/docker.sock \
  ghcr.io/advayaflow/docker-sweep

Usage

# Launch interactive TUI
docker-sweep

# Dry run β€” shows what WOULD be deleted, touches nothing
docker-sweep --dry-run

# Only show resources older than 7 days
docker-sweep --min-age 7

# JSON output (great for scripting / CI)
docker-sweep --json

# Combine: JSON of resources older than 30 days
docker-sweep --json --min-age 30 | jq '.total_reclaimable'

Keyboard Shortcuts

Key Action
↑ / ↓ or k / j Navigate
SPACE Select / deselect item
ENTER Expand / collapse section
A Select all items
C Clear all selections
D Delete selected (with confirmation)
R Refresh
Q Quit

Flags

Flag Default Description
--dry-run false Preview deletions without executing
--json false Output as JSON, no TUI
--min-age N 0 Only show resources older than N days
--version β€” Print version

JSON Output Schema

{
  "images": [
    {
      "id": "a1b2c3d4e5f6",
      "label": "node:18",
      "size_bytes": 1027604480,
      "size": "980.0 MB",
      "age": "47d ago",
      "detail": "dangling"
    }
  ],
  "containers": [...],
  "volumes": [...],
  "build_cache": [...],
  "total_reclaimable_bytes": 15234236416,
  "total_reclaimable": "14.2 GB"
}

How It Works

docker-sweep talks directly to the Docker socket (/var/run/docker.sock) using the official Docker Go SDK. It calls the same APIs Docker CLI uses:

  • ImageList β†’ finds images not referenced by any container
  • ContainerList with status=exited β†’ stopped containers
  • VolumeList with dangling=true β†’ volumes not mounted anywhere
  • DiskUsage β†’ build cache layers

No root required. No side effects until you press D and confirm.


Why Not docker system prune?

docker system prune docker-sweep
Shows size before deleting ❌ βœ…
Per-item selection ❌ βœ…
Shows resource age ❌ βœ…
Groups by project ❌ βœ…
Build cache breakdown ❌ βœ…
Dry run mode ❌ βœ…
JSON output ❌ βœ…

Contributing

PRs welcome. Run make tidy before submitting.

git clone https://github.com/advayaflow/docker-sweep
cd docker-sweep
make tidy
make build
make dry-run   # test without Docker resources being deleted

License

MIT β€” see LICENSE.

Directories ΒΆ

Path Synopsis
cmd
docker-sweep command
internal
tui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL