Safely find and clean unused Docker resources from the command line.
- Node.js 18+
- Docker installed and the daemon running
Run directly with npx:
npx dockleanOr install globally:
npm install -g dockleanScan only (no deletes):
dockleanInteractive cleanup (prompts before delete):
docklean --allSelective cleanup:
docklean --containersDry run (shows commands that would run):
docklean --all --dry-runSkip prompt:
docklean --all --forceFilter by age:
docklean --images --older-than 7d--containersClean stopped/exited containers--imagesClean unused/dangling images--volumesClean unused volumes--networksClean unused networks--cacheClean build cache--danglingDangling images + stopped containers + unused volumes--allAll unused resources--older-than <duration>Only clean items older thanm/h/d/w--dry-runPrint what would be removed--forceSkip confirmation prompt--yesAlias for--force--jsonJSON output--quietMinimal output--verboseMore verbose output--no-colorDisable colored output
0Success1Docker CLI not found2Docker daemon not running3Nothing to clean or user declined4Partial failure5Invalid arguments
npm install
npm run build
npm run dev -- --all --dry-run