DevOps•6 min read•Aug 28, 2026

Purging Docker.raw VM Disks and Dangling Containers on macOS Sequoia

Marcus Vance
DevOps Architect

Quick answer

Run `docker system df` to see what is using space, then `docker system prune -a` (add `--volumes` only if you do not need local volume data). Docker Desktop stores everything in one disk image, Docker.raw, under ~/Library/Containers/com.docker.docker — never delete that file directly; lower the virtual disk limit in Docker Desktop → Settings → Resources instead.

1. The Docker.raw Growing Disk Problem

On macOS Sonoma and Sequoia, Docker Desktop stores container layers, volumes, and build caches in a virtual disk image located at:

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

This file automatically expands as you pull images and build Dockerfiles. However, when you delete images inside Docker, the host macOS APFS filesystem does not automatically shrink the Docker.raw file on disk.

2. Pruning vs. Disk Compaction

There is an important distinction between freeing container layers inside the VM and reclaiming the physical disk space on your Mac:

  • Docker System Prune: Deletes stopped containers, unused networks, and dangling layers inside the virtual filesystem.
  • APFS TRIM Compaction: Reallocates zeroed blocks from the virtual disk back to macOS free storage.

3. Step-by-Step Pruning Commands

# 1. Prune all unused containers, dangling images, and networks
docker system prune -f

# 2. Prune BuildKit compiler cache (often 20+ GB)
docker builder prune -a -f

# 3. Nuclear cleanup: remove all images and unreferenced volumes
docker system prune -a --volumes -f

4. Compacting the Sparse Virtual Disk

In modern Docker Desktop versions, enabling VirtioFS and dynamic disk trimming allows Docker to issue fstrim commands directly to the macOS APFS container.

Skip the Terminal: see it all in one scan

CleanYourMac Space maps every cache, build folder and model file by size, then cleans only what you pick — everything goes to the Trash first, so it's always recoverable.