Because macOS runs a Unix Darwin kernel rather than native Linux, Docker Desktop operates inside a lightweight virtual machine. That virtual machine stores its data in a single massive file: ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw.
The Docker.raw Virtual Disk Trap
The core problem with this virtual disk format is that it expands dynamically as you pull images, build layers, and spin up databases, but it never shrinks automatically when you delete containers. Over six months of software engineering, Docker.raw commonly balloons to 64 GB or more.
Standard Docker System Prune
Begin by removing unused containers, networks, dangling build caches, and images:
# Remove stopped containers, dangling images, and build caches
docker system prune -a --volumes -f
Compacting the Virtual Disk
Running docker system prune frees space inside the virtual machine, but macOS will still see the outer Docker.raw container taking up 60+ GB. To force a compaction:
- Open Docker Desktop Settings.
- Navigate to Resources → Advanced.
- Click Trim Virtual Disk to reclaim unused storage back to APFS.