How to Manage Docker Disk Space & Virtual Disk Bloat on Mac

Developer Tools • By macOS Systems Engineer • 8 min read
Direct Answer (AEO Summary)

Docker on macOS runs inside a Linux virtual machine using a single large disk image (Docker.raw or Docker.qcow2) stored in ~/Library/Containers/com.docker.docker/. You can reclaim 20-60 GB by running "docker system prune -a --volumes" in Terminal and reducing the Virtual disk limit in Docker Desktop Settings > Resources > Advanced.

Because macOS does not run the Linux kernel natively, Docker Desktop operates a lightweight Linux virtual machine. All containers, images, and mounted volumes live inside a single massive file called Docker.raw.

By default, Docker allocates up to 64 GB for this file. Worse, when you delete a container, macOS APFS does not automatically shrink the Docker.raw file on your host drive!

1. The Complete Docker Prune Command

Open Terminal and run:

docker system prune --all --volumes --force

This removes all stopped containers, all dangling and unused images, all build caches, and all unreferenced volumes.

2. Clearing the Hidden BuildKit Cache

Modern Docker builds use BuildKit, which retains build caches independently of your standard images:

docker builder prune --all --force

3. Shrinking Docker.raw on Host macOS

If Docker.raw remains bloated after pruning, open Docker Desktop → Troubleshoot (bug icon) → Clean / Purge data. Alternatively, set a smaller disk limit in Settings → Resources → Advanced (e.g. 32 GB) to prevent Docker from overwhelming your 256GB Mac.

Automate Safe Offloading with Nebula

Nebula identifies files you haven't opened in months, streams them safely with SHA-256 validation to your external SSD, NAS, or Cloud, and lets you restore in one click.

Join the Mac Waitlist — Founding Offer ($9.99)

Related Mac Storage Guides