Skip to content
Black Friday · 25% off · Lifetime Pro for $5.99 $7.99Ends in …Code BLACKFRI25

How to Compact Docker.raw on Mac

Docker Desktop stores Linux container data in a sparse disk image (Docker.raw). Pruning frees logical space inside the VM, but macOS may not see it until you compact or reset the image.

Developer GuideBy Ojas PalorkarUpdated November 24, 20266 min readTested on macOS 15.1, Docker Desktop 4.x

Quick answer

Prune with docker system df && docker system prune -a, quit Docker Desktop, then use Troubleshoot → clean/compact options. Typical recovery after heavy use: 10–40 GB on Docker.raw.

Where the space goes

~/Library/Containers/com.docker.docker/Data/vms/*/Docker.rawdocker system prune -a
20–80 GBAfter prune
BuildKit cachedocker builder prune -a
5–25 GBYes
Typical sizes on a 0 to 80 GB scale. Your disk will differ.

Why Docker.raw keeps growing

On Apple Silicon and Intel Macs, Docker runs in a lightweight VM. All images, containers, and volumes live inside Docker.raw. Deletes inside Docker do not always shrink the host file until compaction runs.

Step 1: Prune unused artifacts

docker system df
docker system prune -a
docker builder prune -a

Confirm no stopped stacks need orphaned images before -a.

Step 2: Compact the disk image

  1. Quit Docker Desktop completely.
  2. Open Docker Desktop → Settings → Resources or Troubleshoot.
  3. Use Clean / Purge or vendor compact controls after pruning.
  4. As a last resort, export needed volumes and use Reset to factory defaults (destructive).

FAQ

Why does Docker.raw stay large after docker prune?

Pruning frees space inside the Linux VM but the sparse APFS image (Docker.raw) often does not shrink until you compact it or reset Docker Desktop data.

Is compacting Docker.raw safe?

Yes if your images and volumes are already pruned. Quit heavy builds first; compaction only reclaims unused blocks inside the disk image.

How much space can I recover?

After a full prune, many dev Macs recover 10–40 GB from Docker.raw alone, depending on image churn.

Run this cleanup in SpaceWise

Same targets, Recovery Bin rollback, no Terminal required. Free tier included.

Download for Mac