Docker, containers & VMs

Why docker system prune Didn't Free Disk Space on Your Mac (Real Fix)

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.raw or the equivalent .qcow2 file
  • Docker data root for images/volumes (inside the VM, not directly accessible): effectively mapped from that same .raw image

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

  1. Prune Docker internals first. Open a terminal and run:
    docker system prune -a --volumes
    Confirm when prompted. This removes all unused images, stopped containers, unnamed volumes, and dangling build cache.
  2. 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.
  3. 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:
    docker run --privileged --pid=host docker/desktop-reclaim-space
    On newer Docker Desktop versions (4.20+) the command is simply:
    # From Docker Desktop's built-in disk management
    docker desktop reclaim-disk-space
    If neither is available, use qemu-img or the macOS hdiutil compact tool:
    hdiutil compact ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
  4. 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.
  5. Verify the result. Check the VM image size again:
    du -sh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
    You should see it match roughly the space actually occupied by your remaining images and volumes.

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:

  1. Export any volumes you want to keep: docker run --rm -v myvolume:/data -v $(pwd):/backup busybox tar czf /backup/myvolume.tar.gz /data
  2. Uninstall Docker Desktop via Docker Desktop → Troubleshoot → Uninstall or drag the app to Trash and then manually remove ~/Library/Containers/com.docker.docker and ~/Library/Group Containers/group.com.docker.
  3. Download and reinstall the latest Docker Desktop.
  4. 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 prune regularly — weekly if you pull many images during development.
  • Avoid using the latest tag 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 compact or Docker Desktop UI equivalent) alongside your regular Mac disk maintenance.

Reclaim your disk in one click

Crumb audits your whole Mac, tells you what's safe to delete, and frees the space in seconds — private, local, and Apple-notarized.

Download Crumb for macOS

Frequently asked questions

Is it safe to delete the Docker.raw file directly?
No. Deleting Docker.raw directly while Docker Desktop is installed will corrupt your Docker setup and cause it to fail on next launch. To reclaim that space safely, either use Docker Desktop's built-in Purge/Compact option or do a clean uninstall through Docker Desktop's own Troubleshoot menu, which removes the file properly.
Why does About This Mac still show the same free space after docker system prune?
docker system prune frees blocks inside the Linux VM that Docker runs on macOS, but macOS only sees the VM's disk-image file as a whole. Until you compact or shrink that image file using hdiutil compact or Docker Desktop's disk-reclaim tool, the reported free space on your Mac won't change.
Will docker system prune delete data I still need?
It will remove all stopped containers, all images not referenced by a running container, all unused networks, and (with --volumes) all unnamed volumes. Named volumes you created explicitly are only removed if you pass --volumes AND they are not referenced by any container. Running containers and their images are never touched.
How much space can I realistically reclaim from Docker on Mac?
It varies widely by workload, but developer machines that have been running Docker for a year or more commonly see the VM image reach 40–80 GB. After a full prune followed by disk compaction, many users recover 20–50 GB. The actual recovery depends on how many unused images and build-cache layers had accumulated.
Does Docker Desktop on Apple Silicon use more disk space than on Intel?
Not inherently — the VM disk-inflation problem affects both architectures equally. Apple Silicon uses the macOS Virtualization framework instead of HyperKit, but the same Docker.raw disk-image model applies, and the same compaction steps work on both platforms.