Guide · Docker
Docker.raw is huge on your Mac? How to get the space back
Docker Desktop keeps every image, container, volume and build cache inside a single disk image on your Mac. It grows quietly and never shrinks on its own. Here is how to see what is inside and free the space in the right order.
Where the space goes
Docker on macOS runs Linux in a small virtual machine. Everything that machine stores lives in one file:
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
It is a sparse file, so Finder and ls -lh show its maximum size, not what it really uses. To see the real number, ask for the allocated size instead:
du -h ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
In Docker Desktop you find the same information under Settings → Resources → Advanced, next to the disk image location and its maximum size.
Step 1: see what Docker is holding
docker system df
This lists images, containers, local volumes and build cache, each with a “reclaimable” column. Build cache and unused images are usually the largest part and the safest to remove.
Step 2: remove what can come back
Work from the safest to the riskiest. Each command asks for confirmation.
- Build cache. Rebuilt automatically on the next build.
docker builder prune -a - Images no container uses. Pulled again from the registry when you need them. Images you built yourself and never pushed are gone for good, so check the list first with
docker images.docker image prune -a - Stopped containers. Anything you changed inside a container is lost. Some local setups keep the whole project inside the container, so look before you delete.
docker container prune - Volumes. Volumes hold databases and uploads. Only remove the ones you are sure about, one by one, with
docker volume rm <name>. Avoiddocker volume pruneunless you know every volume is disposable.
docker system prune combines several of these steps. It is convenient, but it removes more at once, so the step-by-step order above is easier to control.
Step 3: make macOS see the free space
With the default Docker.raw format, Docker Desktop hands freed space back to macOS within seconds. If the file still looks too big, trigger it manually:
docker run --privileged --pid=host docker/desktop-reclaim-space
Then check again with du -h. Finder can take a moment to update.
Step 4: cap the size
Settings → Resources → Advanced → Disk image size sets the maximum. Be careful: lowering it deletes the disk image, and with it every image, container and volume. Clean up first, then decide whether a lower limit is worth starting from scratch.
Never move or delete Docker.raw in Finder. Docker Desktop loses track of it; use the setting to move it to another drive instead.
The same, with a preview
Depflush asks Docker which images and volumes are in use, preselects only the build cache and images that can be pulled again, and lists stopped containers and orphaned volumes with a warning, unticked. You see every item with its size before anything is removed. It is free and open source.
Source: Docker Desktop for Mac FAQ.