Docker · Arazzo Workflow
Docker Reclaim Disk Space on a Host
Version 1.0.0
Measure disk usage, prune stopped containers, dangling images, unused volumes and networks, and the build cache, then measure again.
Provider
Workflows
reclaim-disk-space
Measure, prune in dependency order, and re-measure host disk usage.
Takes a before reading of image, container, volume, and build-cache usage, prunes stopped containers, then dangling images, then unused volumes and networks, then the build cache, and takes an after reading to quantify what was reclaimed.
1
measureBefore
SystemDataUsage
Take a before reading across all four object types so the reclaim can be quantified rather than guessed at.
2
pruneContainers
ContainerPrune
Prune stopped containers older than the age filter first. This must precede the image prune, because an image still referenced by a stopped container cannot be removed.
3
pruneImages
ImagePrune
Prune only dangling — unused and untagged — images. Setting dangling to false would remove every unused image, including tagged ones a pipeline expects to still be cached.
4
pruneVolumes
VolumePrune
Prune unused volumes, scoped by the supplied label filter. This is the destructive step in the flow — a volume prune without a filter will take any unused named volume with it, data and all.
5
pruneNetworks
NetworkPrune
Prune user-defined networks with no attached containers, older than the age filter. Pre-defined networks are never touched by this call.
6
pruneBuildCache
BuildPrune
Trim the BuildKit cache down to a reserved size rather than clearing it outright, so subsequent builds keep most of their cache hits.
7
measureAfter
SystemDataUsage
Take the after reading across the same four object types so the caller can diff it against the before reading and report what was actually reclaimed.