Docker taking up too much space on Mac

Updated · By the iClearer team

Short answer

Docker Desktop for Mac keeps all images, containers, volumes and build cache inside one disk image file, which grows as you use Docker. To reclaim space, see what is using it with docker system df, then remove what is unused with docker system prune. Add -a to also remove images no container is using. Do not delete the disk image file by hand: that removes everything, including volumes.

Where Docker stores data on a Mac

Docker Desktop runs a small Linux virtual machine, and everything Docker stores sits in that machine’s disk image:

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

The file is sparse, so Finder can show a size far larger than what it really uses. To see the real figure:

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

See what is using the space

docker system df

This shows the space used by images, containers, local volumes and build cache, and how much of each is reclaimable. Add -v for a line-by-line list.

Reclaim space safely

Work down this list and stop when you have enough space back.

CommandRemovesRisk
docker builder pruneBuild cacheNone. Next builds are slower.
docker container pruneStopped containersYou lose anything written inside those containers.
docker image pruneDangling images (untagged)None.
docker image prune -aEvery image not used by a containerImages are pulled or built again when needed.
docker system pruneStopped containers, unused networks, dangling images, build cacheLow.
docker volume pruneUnused anonymous volumes (add -a for named ones)High. Volumes hold database data that cannot be rebuilt.

Careful: docker system prune -a --volumes does all of the above at once. Check docker volume ls first, and do not run it if a stopped container owns data you need.

If the disk image does not shrink

Docker Desktop hands freed space back to macOS, but it can take a little while after a prune. If the file is still large:

Colima

Colima keeps its virtual machine disks in ~/.colima. The same docker prune commands work. To remove a Colima machine and its disk entirely:

colima delete

See Docker next to your other developer files

iClearer’s Builders screen lists Colima and Docker folders in your home folder with their sizes, labelled Ask first because they can hold data that cannot be rebuilt. For Docker Desktop’s disk image, use the Docker commands above. iClearer also clears the caches that sit beside Docker on most developer Macs: Xcode DerivedData, npm, pnpm, Yarn, pip, Homebrew and Gradle.

Scanning is free on every Mac and the free plan includes 500 MB of cleanup. Unlimited cleanup starts at $29.99 per year for one Mac, with a 14-day money-back guarantee. Needs macOS 13 Ventura or later, Intel or Apple silicon.

Frequently asked questions

Why is Docker taking up so much space on my Mac?

Docker Desktop stores every image, container, volume and build cache layer in one disk image file, and the file grows as you pull and build. Old images and build cache are usually the largest part. Run docker system df to see the breakdown.

Is it safe to run docker system prune?

Yes for most setups. It removes stopped containers, unused networks, dangling images and build cache. It does not remove volumes or tagged images unless you add --volumes or -a.

Where is Docker.raw on a Mac?

In ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw. It is a sparse file, so Finder may show its maximum size. Run du -h on the file to see how much disk space it really uses.

Can I delete Docker.raw?

Only if you want to lose everything in Docker. Deleting the file removes all images, containers and volumes. Use docker system prune, or Clean / Purge data in Docker Desktop, instead.

Does docker system prune delete volumes?

No, not by default. Volumes are only removed if you add the --volumes flag or run docker volume prune. Volumes often hold database data, so check docker volume ls before removing them.

Related guides