title: "How to Clear Docker Desktop Disk Space on macOS (Shrink Docker.raw)"
subtitle: "Why Docker.raw never automatically shrinks on APFS, and how to reclaim 60GB+ of dead container and image bloat."
description: "Is Docker.raw consuming 64GB to 128GB on your Mac? Discover why macOS APFS sparse files grow indefinitely, how to run docker system prune safely, and how to shrink or reset your virtual disk."
datePublished: "2026-03-08"
dateModified: "2026-03-24"
author: "CleanSlate Systems Engineering"
readingTime: "8 min read"
category: "Docker"
targetBloat: "50GB – 120GB"
keywords:
- "clear docker desktop disk space macos"
- "shrink docker raw mac"
- "docker system prune a volumes mac"
- "docker.raw taking 64gb"
- "docker mac virtual disk reclaim"
- "clean buildx cache docker mac"
faq:
- question: "Why does Docker.raw stay at 64GB even after I delete all my containers and images?"
answer: "Docker on macOS runs inside a Linux virtual machine. The virtual disk (Docker.raw) is formatted with an ext4 filesystem inside a sparse APFS container. When files are deleted inside Linux, ext4 marks the sectors as free internally, but macOS APFS is not notified, so the host file on your Mac never shrinks automatically."
- question: "Will running 'docker system prune -a' delete my persistent database data?"
answer: "No, unless you include the '--volumes' flag. 'docker system prune -a' only deletes stopped containers, unused networks, and dangling/unreferenced images. To delete named volumes (which hold persistent databases like Postgres or MySQL), you must explicitly supply '--volumes'."
- question: "Where is Docker.raw stored on macOS Sonoma and Sequoia?"
answer: "On modern macOS versions, Docker.raw is located at ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw. Older versions may store it at ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw."
- question: "Can I just delete Docker.raw in Finder to get my space back?"
answer: "Yes, but you must first quit Docker Desktop completely. Deleting Docker.raw will reset Docker to a clean state. When you launch Docker Desktop again, it will automatically recreate a fresh, empty ~2GB sparse virtual disk."
If you run Docker Desktop on a Mac, you have likely encountered the infamous `Docker.raw` virtual disk file.
You check your storage usage, only to find that Docker is silently claiming **64GB, 90GB, or even 128GB** inside:
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.rawEven more frustrating: you run `docker rm` and `docker rmi` to delete all your images, yet `Docker.raw` remains frozen at 64GB on your host Mac!
In this guide, we explain the filesystem physics behind why Docker.raw doesn't shrink on APFS, provide step-by-step commands to audit and prune your Docker storage, and show how to reclaim your gigabytes without losing your active projects.
1. The Architectural Trap: Why Doesn't Docker.raw Shrink?
On Linux, Docker runs natively on the host kernel using cgroups and namespaces.
On macOS, because Darwin is not Linux, Docker Desktop must run a lightweight **Linux Alpine/Ubuntu Virtual Machine** managed by Apple's Hypervisor framework (`Hypervisor.framework`).
Here is why `Docker.raw` balloons:
1. Docker allocates a virtual sparse disk formatted with a Linux **ext4** filesystem.
2. As you pull container layers and build multi-stage Dockerfiles, Linux requests new blocks from macOS APFS. APFS expands the physical allocated size of `Docker.raw` on your SSD.
3. When you delete a 20GB container inside Docker, ext4 updates its internal inode free-block bitmap.
4. **However, Linux does not issue an APFS trim/hole-punch (`fstrim`) call back across the hypervisor boundary to macOS.**
5. Consequently, your host SSD still holds 64GB of allocated physical blocks for a virtual disk that is mostly empty inside!
2. Step 1: Inspecting Real Docker Storage with `docker system df`
Before deleting anything, inspect what Docker is actually using:
docker system df -vThis will print a detailed breakdown across four categories:
Often, you will find that **Build Cache** is eating 30GB to 50GB on its own!
3. Step 2: Running a Deep Clean with `docker system prune`
Standard Prune (Safe for Databases):
To remove all stopped containers, unused networks, and dangling images:
docker system prune -aFull Deep Prune (Includes BuildKit Cache):
To also purge all BuildKit build layers:
docker builder prune -a --forceNuclear Prune (Including Unused Volumes):
⚠️ **Warning:** If you have persistent database data (e.g. Postgres, MongoDB) in Docker volumes that are not bound to host folders, running `--volumes` will wipe those volumes!
docker system prune -a --volumes --force4. Step 3: Compacting or Recreating `Docker.raw` to Free APFS Blocks
Even after pruning, macOS will still report `Docker.raw` as 64GB due to the sparse trim limitation.
To force APFS to release the physical disk blocks, you have two proven solutions:
Method A: Use Docker Desktop's "Clean / Purge Data" GUI
1. Open **Docker Desktop**.
2. Click the **Troubleshoot (Bug)** icon in the top navigation bar.
3. Click **Clean / Purge data**.
4. Select **Virtual disk** and click **Delete**.
5. Docker Desktop will rebuild a clean ~2GB virtual disk immediately.
Method B: Manual Command-Line Recreation (Fastest)
If Docker Desktop UI is hanging or unresponsive:
# 1. Quit Docker completely
killall Docker 2>/dev/null
# 2. Inspect physical allocated size vs logical size
ls -lh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
# 3. Remove the unshrinkable virtual disk file
rm -f ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
# 4. Restart Docker Desktop
open -a DockerDocker Desktop will launch, notice the missing VM disk, and initialize a brand-new, clean virtual disk in under 10 seconds. You instantly recover 60GB to 100GB of host SSD capacity.
5. Alternative: Switch to Modern Sparse VM Engines (OrbStack)
If you are tired of dealing with `Docker.raw` bloat entirely, consider **OrbStack**, a native macOS container runtime.
OrbStack uses dynamic two-way block allocation: when you delete a 10GB container in OrbStack, it triggers immediate APFS TRIM calls to macOS, shrinking host disk usage in real time without manual pruning.
6. How CleanSlate Visualizes Docker Bloat
Manually running terminal prune commands doesn't show you how Docker compares to the rest of your system disk.
**CleanSlate** integrates a dedicated **Container & VM Explorer**:
Download the free scanner or buy the lifetime Pro license for $14.99 one-time.