lysosome

Guide · Docker

Docker disk usage on a Mac: find it and reclaim it safely

Updated · Scott Havird

short answer

Run docker system df to see what images, containers, volumes and build cache take. docker builder prune is always safe, docker image prune removes untagged images, and docker image prune -a removes every image no container uses (they are pulled again when needed). Look at docker volume ls before deleting any volume: volumes hold databases and state.

Why Docker fills a Mac

On macOS, Docker Desktop runs containers in a Linux virtual machine, and everything that VM stores lives in a single disk image: ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw. Every image you pull, every layer of build cache and every volume adds to it. The file is sparse, so Finder and ls -l show its maximum size, while du shows what it actually uses on disk.

du -h ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw

The maximum is set in Docker Desktop under Settings > Resources > Advanced. Lowering it doesn't free space by itself; removing what's inside does.

See what's inside

docker system df       # totals for images, containers, local volumes, build cache
docker system df -v    # per image, container and volume, with what's in use
docker volume ls

The RECLAIMABLE column of docker system df is the space not used by any container. Images used by a running or stopped container aren't reclaimable until the container is removed.

Reclaim it safely by hand

CommandRemovesCost
docker builder pruneBuild cache not in useregenerable the next build is slower once
docker image pruneUntagged (dangling) imagesregenerable usually nothing
docker container pruneStopped containersreview their writable layer and logs
docker image prune -aEvery image no container usesexpensive pulled or rebuilt on next use
docker volume rm <name>One volumereview databases and state don't come back

OrbStack keeps its containers, images, volumes and Linux machines in ~/Library/Group Containers/HUAQ24HBR6.dev.orbstack/data. When OrbStack is your Docker engine, the same docker commands above work against it.

How lysosome does it

lysosome caches --category containers        # read-only report
lysosome clean --caches --only docker-build-cache        # dry run: docker builder prune
lysosome clean --caches --only 'docker-*' --tier regenerable_expensive
                                             # also images no container uses

lysosome reads docker system df -v, and only if Docker is already running; it never starts Docker. The build cache is regenerable and cleaned with docker builder prune --force. Images no container uses are regenerable_expensive and removed with docker image rm (a multi-tagged image is one item, counted once). Images a container uses, every volume, and OrbStack's data folder are labeled review and never cleaned.

The same report covers the rest of a dev machine: agent worktrees, build artifacts, local AI models and Xcode.