Docker system prune not giving back disk space on Mac
Docker.raw still huge after docker system prune on Mac? See why the file doesn't shrink, how to check real usage, and how to reclaim space safely.
TroubleshootingUpdated 6 min read
On this page
You ran docker system prune, Docker said it reclaimed a lot of space, and your Mac's free space didn't move. ~/Library/Containers/com.docker.docker still shows something like 64 GB. This page explains where the space is and how to get it back.
The file in question is usually here:
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.rawWhy docker system prune doesn't shrink Docker.raw
Docker.raw is one sparse file that acts as Docker's whole disk. Images, containers, volumes and build cache all live inside it. Pruning deletes things inside that virtual disk and marks those blocks free for Docker to reuse. The file on macOS doesn't automatically shrink to match.
A request on Docker's public roadmap describes the same behavior. It says prune cleans up the internal state of the disk, but the image on your OS stays the same size. One user in that request reported a Docker.raw of about 1 TB when roughly 100 GB would have been enough.
The common causes, most likely first:
- The file keeps its high-water mark. Docker used the space once, you pruned, and the file stayed large.
- Prune didn't remove what is using the space. A plain
docker system pruneleaves tagged images that no container uses, and it leaves volumes. - Build cache. If you build images often, this is frequently the biggest item.
- You're reading the wrong number. A sparse file has an apparent size (the limit it can grow to) and an allocated size (what it takes on disk). I can't tell you which one your tool shows. Finder-style allocated sizes are the ones that matter for free space.
Step 1: Compare Docker's view with the file on disk
Both commands are read-only. Docker Desktop must be running for the first one.
docker system dfThis lists space used by images, containers, local volumes and build cache, and how much of each is reclaimable.
ls -lh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
du -h ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.rawls shows the apparent size. du shows the space allocated on disk. If du shows about 64 GB, the file really takes that much of your Mac's storage. If ls is far bigger than du, the large number is only the size limit.
Then pick your path:
docker system dfshows a lot reclaimable: go to Step 2.docker system dfis small butduis large: skip to Step 3.
If Terminal says "Operation not permitted" for the Containers path, allow the access prompt if macOS shows one. Otherwise open System Settings, search for "Full Disk Access" and add Terminal.
Step 2: Prune the right things inside Docker
Run these in order and check docker system df after each.
docker system pruneRemoves stopped containers, unused networks, dangling images and unused build cache. It asks first.
docker builder pruneClears build cache.
docker system prune -aAlso removes every image not used by a container.
Volumes need a look first, because databases and other app data often live in them.
docker volume ls
docker volume prunedocker volume prune removes unused volumes, and that data can't be recovered. Which volumes count as unused depends on your Docker version, so read the prompt before you confirm. Docker's documentation page on pruning unused objects explains each command.
Step 3: Ask Docker Desktop to give the space back
If docker system df looks small but du is still large, the free blocks are inside the disk and macOS doesn't see them.
- Open Docker Desktop and go to its Settings.
- Open Resources and look for the disk image options. Depending on your version, that is a disk usage or reclaim-space action, or a Disk image size setting.
- If your version has a reclaim or compact action, run it. Then run the
ducommand from Step 1 again. - If you only find a size setting, read Docker's warning before changing it. Lowering the limit can be a reset-level change, so back up volume data first.
Docker Desktop's labels change between releases, so check Docker's documentation for your version if these options look different.
Step 4: Reset the Docker disk (last resort)
A fresh disk image starts small again. The cost is everything inside the old one.
- Copy out what you need: data in volumes, and any image you can't pull or build again.
- In Docker Desktop, open the Troubleshoot menu and choose its clean or purge data option. Labels vary by version.
- After the reset, pull or rebuild only the images you actually use.
Quick reference
| Symptom | Likely cause | Fix |
|---|---|---|
docker system df shows large reclaimable numbers | Prune was too conservative | docker builder prune, docker system prune -a |
| Volumes take most of the space | Prune skips volumes | Review with docker volume ls, then prune |
du large, docker system df small | Free space is inside the disk image | Docker Desktop reclaim or size option |
ls huge, du modest | Sparse file; big number is the limit | Nothing to fix; trust du |
| Nothing shrinks it | Disk image keeps its size | Back up, then reset |
Don't trash Docker.raw
Docker.raw is the virtual disk itself. Trashing it deletes every image, container and volume inside, and the Trash frees nothing until you empty it. Shrink it through Docker, as above.
Checklist before you try again
- Docker Desktop is running and
docker system dfworks. - You noted the
du -hsize ofDocker.rawbefore pruning. - You reviewed
docker volume lsbefore any volume prune. - You backed up volume data you can't recreate.
- You emptied the Trash if you removed other files while freeing space.
What Gigabroom does and doesn't do here
You don't need an app for this. Terminal and Docker Desktop are enough.
Gigabroom can help you spot the file and keep you from trashing it. In Developer Junk (⌘7), the Containers & VMs section lists a Docker Disk Image row. It is marked Review and report-only, so it can't be swept. The row offers Copy the command for docker system prune and Open Docker Pruning Guide. Gigabroom never trashes the Docker disk image and never runs prune for you. It can't compact Docker.raw either, so shrinking stays in Docker Desktop.
For the rest of your developer clutter, see cleaning developer junk and freeing disk space on a Mac for developers. Gigabroom is part of MacSuite, and you can try it free for 7 days.
If nothing works
Contact Docker support, or open an issue on Docker's GitHub repositories. Include your Docker Desktop and macOS versions, the output of docker system df, the ls -lh and du -h results for Docker.raw, and the options you saw under Settings > Resources.
Subject: Docker.raw doesn't shrink after docker system prune (macOS)
Docker Desktop version: [version]
macOS version: [version]
After running docker system prune (and docker builder prune), the file
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
still uses [X] GB on disk (du -h).
docker system df output:
[paste output]
Options I see under Settings > Resources: [list them]
What I tried: prune, builder prune, [reclaim/size option]
How can I reduce the size of Docker.raw without losing my volumes?If your Mac's free space still isn't dropping after you delete other things, see Mac storage not going down after deleting files.
Common questions
Is it safe to delete Docker.raw myself?
No. It holds all your images, containers and volumes. Use Docker Desktop's own reset if you want a fresh, small disk.
Why does Finder show a different size than Docker?
Docker reports what is used inside its virtual disk. Finder and du report what the file occupies on your Mac. After pruning, the first drops and the second may not.
Does docker system prune delete volumes?
Not by default. Volumes need their own prune step, and that data can't be recovered, so check docker volume ls first.
Will the file shrink if I just wait?
Not reliably. If your Docker Desktop version has no automatic reclaim, the file keeps its size until you use a reclaim option or reset the disk.