You ran docker system prune -a --volumes, watched it delete images and containers, saw Docker report several gigabytes reclaimed — then opened About This Mac and found your free space completely unchanged. If docker system prune not freeing space on your Mac is exactly what you're experiencing, you're not doing anything wrong. The disconnect is architectural: Docker Desktop on macOS runs inside a Linux virtual machine, and that VM stores everything in a single large disk-image file that expands to absorb data but almost never shrinks on its own, even after you delete every container and image inside it.
Why Docker on macOS Is Different from Docker on Linux
On Linux, Docker writes images and container layers directly to the host filesystem, so deleting them with docker system prune immediately returns blocks to the OS. On macOS, Apple Silicon and Intel Macs both run Docker Desktop on top of a lightweight Linux VM (historically HyperKit, more recently Apple's built-in Virtualization framework). All Docker data lives inside that VM's virtual disk. From macOS's perspective, you deleted nothing — the VM file simply holds fewer active files internally, but its allocated footprint on your SSD stays the same.
Where the VM Disk Image Actually Lives
The VM disk image is stored in your home directory under the Docker Desktop data folder. Its exact path depends on which Docker Desktop backend you're running:
- Virtualization framework (default on Apple Silicon, macOS 12+):
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw - Legacy HyperKit (older Intel installs):
~/Library/Containers/com.docker.docker/Data/vms/0/Docker.rawor the equivalent.qcow2file - Docker data root for images/volumes (inside the VM, not directly accessible): effectively mapped from that same
.rawimage
Check the current size with:
du -sh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
It is common to see 30–80 GB here on an active development machine, even after a thorough docker system prune.
How docker system prune Actually Helps (and Where It Falls Short)
Running docker system prune is still the correct first step. It deletes stopped containers, dangling images, unused networks, and (with --volumes) unnamed volumes. This frees space inside the VM's filesystem so the VM itself can eventually reclaim blocks — but the VM will not automatically hand those freed blocks back to macOS. That shrinkage requires an explicit extra step.
How to Actually Reclaim Space: Step-by-Step Fix
- Prune Docker internals first. Open a terminal and run:
Confirm when prompted. This removes all unused images, stopped containers, unnamed volumes, and dangling build cache.docker system prune -a --volumes - Quit Docker Desktop completely. Click the Docker whale in the menu bar and choose Quit Docker Desktop. The VM must be stopped before you can compact its disk image.
- Compact the VM disk image. Docker Desktop 4.x and later includes a built-in trim command. Reopen Docker Desktop, then go to Settings → Resources → Advanced and click Clean / Purge data — or use the CLI helper:
On newer Docker Desktop versions (4.20+) the command is simply:docker run --privileged --pid=host docker/desktop-reclaim-space
If neither is available, use# From Docker Desktop's built-in disk management docker desktop reclaim-disk-spaceqemu-imgor the macOShdiutil compacttool:hdiutil compact ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw - Set a disk size limit. In Docker Desktop → Settings → Resources, lower the Virtual disk limit slider to a realistic cap (e.g. 60 GB instead of the default 256 GB). This prevents silent re-inflation.
- Verify the result. Check the VM image size again:
You should see it match roughly the space actually occupied by your remaining images and volumes.du -sh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
Other Docker-Related Folders Consuming Space on macOS
The VM disk image is not the only place Docker touches your Mac. The table below shows every Docker-related path you should inspect:
| Path | What's stored there | Typical size | Safe to delete? |
|---|---|---|---|
~/Library/Containers/com.docker.docker/ |
VM disk image, Docker Desktop app data | 10–100+ GB | Only via Docker Desktop settings or uninstall |
~/.docker/ |
CLI config, credentials, context files | <10 MB | Yes — you'll need to re-login to registries |
~/Library/Group Containers/group.com.docker/ |
Docker Desktop preferences and license data | <50 MB | Only if fully uninstalling Docker Desktop |
~/Library/Logs/Docker Desktop/ |
Application and VM logs | 100 MB–2 GB | Yes — logs only |
/var/folders/.../com.docker.*/ |
Temporary socket and runtime files | Negligible | Cleaned automatically on restart |
The Broader Picture: Other Developer Caches Hiding on Your Mac
Docker is rarely the only offender. Developer-heavy Macs accumulate large caches in several places that macOS's storage view lumps into the vague "System Data" or "Other" buckets. Common examples include:
- Xcode derived data:
~/Library/Developer/Xcode/DerivedData/— can reach 30–50 GB on an active iOS/macOS project. See why Xcode takes up so much space for a detailed breakdown. - Node modules:
~/project/node_modules/directories scattered across repos — each can be hundreds of MB. Cleaning up node_modules on Mac covers safe removal strategies. - Maven local repository:
~/.m2/repository/— grows unbounded as you pull new dependency versions. - Cargo registry:
~/.cargo/registry/and~/.cargo/git/— Rust crate source and compiled artifacts. - Gradle caches:
~/.gradle/caches/— Android and JVM build artifacts. - pip and conda packages:
~/Library/Caches/pip/and~/miniconda3/pkgs/.
A tool like Crumb can audit all of these at once and show what's safe to remove before you delete anything, which is especially useful when several toolchains are competing for the same SSD.
When to Consider a Clean Docker Desktop Reinstall
If the VM disk image has ballooned to an unreasonable size and disk compaction doesn't bring it down far enough, a clean reinstall is sometimes the fastest path. The process is:
- Export any volumes you want to keep:
docker run --rm -v myvolume:/data -v $(pwd):/backup busybox tar czf /backup/myvolume.tar.gz /data - Uninstall Docker Desktop via Docker Desktop → Troubleshoot → Uninstall or drag the app to Trash and then manually remove
~/Library/Containers/com.docker.dockerand~/Library/Group Containers/group.com.docker. - Download and reinstall the latest Docker Desktop.
- Re-import volumes and re-pull only the images you actually use.
After a fresh install the VM image starts at around 3–4 GB. Setting a disk limit immediately keeps it from growing unchecked again.
Preventing the Problem Going Forward
A few habits prevent the disk image from inflating silently over months of development:
- Run
docker system pruneregularly — weekly if you pull many images during development. - Avoid using the
latesttag for base images; pinning versions means you accumulate fewer orphaned image layers. - Use multi-stage Dockerfiles to avoid keeping build dependencies in the final image layer.
- Enable Use containerd for pulling and storing images in Docker Desktop settings — containerd's snapshotting is generally more space-efficient than the legacy overlay2 storage driver.
- Schedule a monthly disk-compaction pass (the
hdiutil compactor Docker Desktop UI equivalent) alongside your regular Mac disk maintenance.