How to
How to clear Docker cache on a Mac (and get the space back)
What docker system prune removes, why Docker.raw can stay large after a prune, and how to reclaim space on Docker Desktop for Mac without wiping named volumes by accident.
Free to scan. Seven days of cleaning free, no card. macOS 26 or later.
Docker on a Mac does not free space the way a normal folder does. Images, containers, volumes and build cache live inside a disk image. You can prune for ten minutes, watch Docker report gigabytes reclaimed, and still see the same number in macOS Storage. Both layers matter.
See what Docker is holding
With Docker Desktop running:
docker system df
docker system df -v
That breaks usage into images, containers, local volumes and build cache, with how much of each is reclaimable.
The disk image itself usually sits here:
du -sh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
ls -lh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
du is the space it really occupies. ls -lh (and Finder Get Info) often show the maximum size of a sparse file, which is not the same thing. Older installs may use Docker.qcow2 in the same folder instead. Do not delete that file in Finder unless you mean to lose every image, container and volume on the machine.
Prune safely, in order
Start narrow. Each command asks for confirmation unless you pass -f.
Stopped containers only:
docker container prune
Dangling images (untagged leftovers):
docker image prune
Build cache:
docker builder prune
Stopped containers, unused networks, dangling images and unused build cache:
docker system prune
Two flags delete more. Read them before you use them:
| Flag | What it also removes |
|---|---|
-a on docker system prune or docker image prune | Every image not used by a container, not only dangling ones |
--volumes on docker system prune | Unused anonymous volumes |
Named volumes often hold databases and uploads. DevSweeper's Docker view lists unused volumes as review only and never removes them. Prefer the same rule by hand: inspect with docker volume ls before any volume prune.
Why macOS still shows the old size
On Docker Desktop for Mac, reclaiming space inside the VM does not always shrink Docker.raw straight away. Docker's documented way to trigger it now:
docker run --privileged --pid=host docker/desktop-reclaim-space
After a prune, Docker's docs say it can take a few minutes for the space to show up on the host.
Do not lower the disk image size limit in Settings › Resources › Advanced to "free" space. Reducing that limit deletes the current disk image and everything in it. Use it as a cap on future growth, not as a cleanup.
Doing it with DevSweeper
On the Caches, Docker and Android page, with Docker running, DevSweeper reads docker system df and shows:
- stopped containers and build cache, cleared with
docker system prune --force - unused images, cleared with
docker image prune --all --force - unused volumes, listed for review only
It also notes that Docker Desktop's disk image gives space back to macOS gradually. Free to scan; seven days of cleaning free, no card.
For package manager caches next to Docker, the same page covers npm, pnpm, Yarn, Bun, Homebrew and the rest. For project-local node_modules, see project folders.