Docker taking up space on your Mac? Here's how to shrink it

Docker Desktop keeps all images, containers, volumes and build cache inside one big disk image. It grows quietly — here's how to see what it really uses and get space back.

Where Docker's space goes

On a Mac, Docker runs Linux in a lightweight virtual machine. Everything inside it lives in one file, usually ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw.

It's a sparse file: Finder may show its maximum size (for example 64 GB) while it actually uses much less. To see the real size, run du -h on it in Terminal — or scan with DiskGarden, which counts the space a file really occupies on disk.

See what's using it

Run docker system df to see how much is taken by images, containers, local volumes and build cache, and how much of each is reclaimable.

Reclaim space

  • docker system prune removes stopped containers, unused networks, dangling images and unused build cache.
  • docker system prune -a also removes every image not used by a container — you'll re-download them when needed.
  • docker builder prune clears just the build cache, often the biggest part for people who build images often.
  • docker volume prune removes unused volumes. Careful: volumes hold data such as local databases; make sure you don't need it.

Docker Desktop hands freed space back to macOS automatically, though it can take a little while for the file to shrink.

Cap how big it can get

In Docker Desktop, open Settings → Resources and lower the virtual disk limit. Docker won't grow past it (lowering it may require resetting Docker's data, so prune first).

As a last resort, Troubleshoot → Clean / Purge data deletes everything Docker stores and starts fresh.

Other virtual machines

Parallels, UTM, VMware Fusion and similar apps also keep each virtual machine as one large file or bundle. Delete VMs you no longer use from inside the app. All of these show up in macOS's System Data.

See where your space went

DiskGarden is a free disk space analyzer for Mac: it maps every folder by size, so the space hogs stand out. No account, and your files never leave your Mac.

Download DiskGarden — free