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 selectiondocker 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 containerContainerListwithstatus=exitedβ stopped containersVolumeListwithdangling=trueβ volumes not mounted anywhereDiskUsageβ 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.