Back to blog

Docker.raw: Why is my Mac out of space when Docker is empty?

Kapil

Docker on Mac has a dirty secret.

You run docker system prune -a. You see "Reclaimed 20GB". You check your Mac's "About This Mac" storage... and nothing changed. You still have 0GB free.

Why? The answer lies in how Docker Desktop for Mac handles virtualization.

The "Sparse File" Trap

Docker for Mac runs a Linux Virtual Machine (VM). All your images, containers, and volumes are stored inside a single massive file on your Mac, usually located at:

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

When you tell Docker to allocate "64GB" of disk size, it creates this file. macOS (and APFS) treats this as a sparse file. It starts small and grows as you add data.

However, it rarely shrinks.

When you delete a 5GB container inside Linux, the file system inside the VM marks that space as free. But the Docker.raw file outside (on your Mac) often keeps hold of that allocated space, expecting you to use it again soon.

How to Actually Reclaim the Space

Method 1: The "Nuke and Pave" (Fastest)

If you can afford to lose ALL your local images and volumes, the easiest way to reset the file size is inside Docker Desktop:

  1. Open Docker Desktop Dashboard.
  2. Go to Settings (gear icon).
  3. Go to Resources -> Disk image size.
  4. Move the slider (change the size slightly, e.g., from 64GB to 60GB).
  5. Click Apply & Restart.

Docker will delete the old .raw file and create a fresh, empty one. You immediately get your space back.

Warning: This will delete ALL your local Docker containers, images, and volumes (including local databases). Only do this if you can recreate your environment from zero.

Method 2: The CLI Prune (Maintenance)

To keep usage low without nuking everything, you must prune aggressively and regularly:

docker system prune -a --volumes
  • -a: Remove all unused images (not just dangling ones).
  • --volumes: Use this carefully! It removes anonymous volumes.

Method 3: Visual Verification

Sometimes, you don't even realize Docker is the culprit. The Docker.raw file is hidden deep inside ~/Library/Containers.

DissectMac shines here. It shows Docker.raw as a single, massive rectangular block on your drive map.

DissectMac Interface

Seeing a single 64GB file next to your 2GB project folder really puts things in perspective. It allows you to make an informed decision: "Do I really need to keep 30 versions of this postgres image, or would I rather have 20GB of free space?"

Don't let phantom virtualization files eat your SSD.

Find Hidden Docker Bloat with DissectMac →

Finding these files too slow?

DissectMac visualizes your entire drive, making it obvious where these hidden caches are hiding.

DissectMac Interface

Continue Reading