hero4hire
Docker

Prune a stale Docker image cache

Reclaim disk space from dangling images and build cache without touching running containers.

Dangling images only

Safe to run at any time — this only removes images with no tag, which are almost always leftover build layers:

bash
docker image prune

Everything not in use by a running container

More aggressive: also removes tagged images that no container currently uses.

bash
docker system prune -a

Just the build cache

bash
docker builder prune --filter until=168h

until takes a duration — 168h prunes build cache older than a week.

On this page