← Blog

Docker.raw is 60 GB and empty. Why the file never shrinks on a Mac, and how to reclaim it

· 2 min read

Docker Desktop on a Mac runs a Linux virtual machine, and that machine's disk is one file:

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

Every image, every container layer, every volume and every build cache lives inside it. The file grows when Docker needs room. It does not shrink when Docker no longer does.

Why prune does not give the space back

docker system prune -a deletes unused images and containers inside the VM. The Linux filesystem inside Docker.raw marks those blocks free, and Docker can write into them again. From the Mac's side the file is unchanged, because the Mac has no idea which blocks the guest considers free.

So you run prune, Docker reports "Total reclaimed space: 31 GB", and Storage settings does not move. Both are telling the truth about different things.

Newer Docker Desktop versions do reclaim space in the background by trimming the disk image when the VM is idle. It is slow, it is not guaranteed, and on many Macs the file simply stays at its high-water mark.

What Finder is showing you

Docker.raw is a sparse file. Finder and ls -l show the allocated maximum, which is the Disk image size limit in Docker's settings, often 64 GB by default. The space it uses is smaller:

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

du reports what is on disk. If du says 58 GB and docker system df says Docker holds 9 GB, the difference is what you can get back.

Reclaiming it

Inside Docker first. See what Docker itself thinks it can free:

docker system df
docker system prune -a --volumes

Read the --volumes flag before you run it. Named volumes hold databases.

Then shrink the file. In Docker Desktop → Settings → Resources → Advanced, move the Disk image size slider and click Apply & Restart. Docker recreates the disk image at the new size. Everything inside it is gone, so this comes after prune, and after exporting any volume you cannot rebuild.

The nuclear version of the same step is the Clean / Purge data button in the Troubleshoot menu, which deletes the VM entirely.

Keeping it from coming back

Where Decruft fits

When Docker is running, Decruft asks it what is reclaimable and shows the number next to your other caches, so you can see Docker beside Xcode and npm. It does not delete Docker.raw or touch the contents of the VM. The shrink step above has to happen in Docker Desktop, where you can see what you are giving up.

Questions

Where is Docker.raw on a Mac?

~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw. Finder shows it at its maximum allocated size, which is often larger than the space it uses on disk.

Does docker system prune shrink Docker.raw?

It frees space inside the virtual machine, so Docker can reuse it. The file on the Mac stays the same size until you resize the disk image in Docker Desktop settings or Docker reclaims it in the background.

Can I delete Docker.raw?

Only if you are prepared to lose every image, container and volume. Deleting it is the same as Clean / Purge data in Docker Desktop. Export any volumes you need first.