Remove unused dangling Docker images
Build a paste-ready command, then review its compatibility and effects before running it.
Destructive command. Review the target and use a preview or dry-run variant first. Safer first stepdocker system df -vRun this lower-risk preview or inspection variant before the state-changing command. Compatibility
Linux + macOSVerified for Linux, macOS using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementsdockerdocker must be installed and available on PATH.
Version supportdocker Current supported releasesVerified for linux, macos using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsWARNING! This will remove all dangling images.Representative successful output; values vary with the selected target and system state.
Known errorsdocker: command not founddocker is missing or is not available on PATH.
Verifydocker system df -vThe preview shows only the intended targets before applying the change.Rollback noteNo universal automatic rollback is available. Capture the current state and use the tool-specific recovery procedure before applying changes.
Command breakdown
01dockerCommandRuns the docker stage of this one-liner.
02imageArgumentPasses image to docker.
03pruneArgumentPasses prune to docker.
Example input
docker image prune
Example output
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N] y
Deleted Images:
deleted: sha256:3d2c18c2f617…
Total reclaimed space: 128.4MB
Illustrative output — exact values vary by system and data.
Official sources