Skip to main content
⚑ OpenDevDocs
Docker
devopsdockerReferenceIntermediate

docker system prune

Reclaim host disk space by removing all unused containers, networks, images, and build cache.

Verified: 2026-09-30
Tested on:docker 27.x
Platforms:
linuxmacoswindows
#docker#cleanup#disk#prune

Command

docker system prune -a --volumes -f


Short Description

docker system prune is the primary cleanup command in Docker. It removes stopped containers, unused networks, dangling images, and build caches to free up substantial gigabytes of disk space.


Syntax

docker system prune [OPTIONS]

Examples

Standard Cleanup (Stopped containers + dangling images)

docker system prune

Deep Cleanup (All unused images + unreferenced volumes)

docker system prune --all --volumes --force

Flags & Options

FlagShorthandDescription
--all-aRemove all unused images, not just dangling ones.
--volumesPrune unused named volumes as well.
--force-fDo not prompt for interactive confirmation.

Warnings

On this page