docker system prune: How to clear Docker cache on Mac
You can clear Docker cache on a Mac with Docker’s own prune commands, such as docker system prune: they remove stopped containers, unused networks, leftover images and build cache. On a Mac all of it lives in one disk image of Docker Desktop, which grows to tens of gigabytes. Here is what each command deletes and what it keeps, so you don’t lose the data in your volumes.
See what takes space
Start Docker Desktop and run this command in Terminal. It shows how much space images, containers, local volumes and build cache take, and how much of it can be reclaimed:
docker system dfAdd -v to see every image, container and volume separately.
Clean up with docker system prune
This command deletes all stopped containers, networks not used by any container, dangling images (untagged layers left after rebuilds) and unused build cache. It asks before deleting. Volumes and tagged images stay:
docker system pruneWith -a it also deletes every image not used by a container, tagged ones included. Docker downloads or builds them again the next time you need them:
docker system prune -aThe --volumes option also deletes anonymous volumes not used by any container. Volumes hold container data, such as the files of a database, so add it only when you know nothing there is needed. Named volumes stay even then.
How to delete Docker images
To clean only images, this command deletes dangling images:
docker image pruneThis one deletes every image that no container uses, stopped containers included:
docker image prune -aTo delete one image, find its name or ID in the list of images:
docker image lsThen delete it. Replace nginx:latest with its name or ID:
docker image rm nginx:latestClear the build cache
If you build images yourself, the build cache is often the biggest part. This command deletes dangling build cache. Add -a to delete all unused build cache. The next builds take longer:
docker builder pruneShrink the disk Docker Desktop takes
Docker Desktop keeps containers, images and volumes in one disk image file, Docker.raw, in ~/Library/Containers/com.docker.docker/Data/vms/0/data. Finder may show its maximum size rather than the space it really uses. After a prune, it can take a few minutes for the space to come back.
- Settings › Resources › Advanced › Disk usage limit sets the most space Docker can use. Lowering it deletes the current disk image: all containers and images are lost.
- Troubleshoot › Clean up data (in the Docker menu in the menu bar) deletes all containers and images and keeps your settings.
If you don’t need Docker at all, see how to uninstall Docker Desktop.
Keep your Mac tidy

MacWashing doesn’t remove Docker images, containers or volumes: use the commands above, Docker knows what is in use. System Junk clears the caches of your other apps and developer tools.
Free trial · macOS 14 or later
Questions and answers
Does docker system prune delete volumes?
No, not by default. With --volumes it deletes anonymous volumes not used by any container. Named volumes stay unless you delete them yourself, for example all unused ones at once: docker volume prune -a
Is it safe to run docker system prune?
Yes, for what it deletes by default: stopped containers, unused networks, dangling images and build cache. If a stopped container may hold something you need, list all containers first: docker ps -a
Why doesn’t the space come back after a prune?
Docker Desktop frees the space inside its disk image, and macOS sees it a few minutes later. Deleting files inside a running container doesn’t free space. Deleting images does.