Why is Docker taking up so much space on my Mac, and how do I reclaim it?

Docker Desktop for Mac keeps all images, containers and volumes in one disk image file, Docker.raw, which grows as you use Docker and does not shrink on its own when you delete things.

Shiva ChandraMaker of Clean House · · 4 min read
Short answer

Docker.raw is the single disk image where Docker Desktop on a Mac stores every image, container and volume. Run docker system df to see what fills it, docker system prune to remove unused items, and expect space to return slowly. Don't delete the file by hand.

Where is Docker.raw and how big is it really?

Docker Desktop stores Linux containers and images in one file, Docker.raw, at:

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

Docker's Mac FAQ says the file has a maximum size and a smaller actual size on disk, and that other tools may show the maximum instead of the real use. Its example is a 64 GB maximum with about 2.3 GB actually used. To see the real number, run this in that folder:

cd ~/Library/Containers/com.docker.docker/Data/vms/0/data
ls -klsh Docker.raw

The first figure in the output is the space actually used on disk, not the maximum. Finder's "Get Info" can differ, so trust this command. Folder details are on Docker.raw.

What is inside Docker, and how do I check?

Ask Docker, which reads and deletes nothing:

docker system df
docker system df -v

The summary table shows images, containers, local volumes and build cache, each with a total size and a "reclaimable" figure. The -v version lists every image, container and volume with its own size, so you can see which one is huge. Build cache and old images are the usual culprits, and volumes are the ones to be careful with because they often hold databases.

What does docker system prune delete?

Docker's reference says a plain docker system prune removes stopped containers, networks not used by a container, dangling images (untagged) and unused build cache. It does not remove volumes. It asks for confirmation first.

docker system prune
CommandRemovesRisk
docker system pruneStopped containers, unused networks, dangling images, unused build cacheLow
docker system prune -aThe above, plus every image no container usesMedium: images re-download or rebuild
docker system prune --volumesAlso removes unused anonymous volumesHigh: can delete data
docker image prune / docker builder pruneOnly images / only build cacheLow
-a and --volumes are the ones to read twice. -a deletes all images not attached to a container, including ones you pulled and will need again. --volumes deletes volume data permanently, and which volumes count as "unused" depends on your Docker version. Run docker volume ls first, and never use --volumes if a database lives in a volume you have not backed up. Prune commands do not use the Trash and cannot be undone.

A careful order: docker builder prune, then docker image prune, then docker system prune. Stop with the first one that frees enough.

Why doesn't Docker.raw shrink after pruning?

Docker's FAQ says space is freed only when images are deleted, not when files are deleted inside a running container, and that after docker system prune it may take a few minutes for the space to return to the Mac. If you still see the file at the same size, wait a few minutes and quit and reopen Docker Desktop, then check again with ls -klsh. The same FAQ documents a command to force reclaiming:

docker run --privileged --pid=host docker/desktop-reclaim-space

This runs a privileged container from Docker's own image. Use it only if you trust that image and the prune alone did not help.

How do I change the Docker Desktop disk size limit?

In Docker Desktop, open Settings, Resources, Advanced. The disk usage limit caps how much space the engine can use, and the page also lets you move the disk image location with its Browse button. Don't move the file in Finder, because Docker Desktop can lose track of it.

Docker's FAQ warns that lowering the limit with the slider deletes the current disk image, and all your containers and images with it. Raise the limit freely, but prune and back up anything you need before lowering it.

Can I delete Docker.raw to get the space back?

Technically yes, and everything in Docker goes with it: images, containers and volumes. If you really want a clean slate, use Docker Desktop's own troubleshoot menu to reset or clean data instead of deleting the file in Finder, so Docker stays consistent. If you only want space, pruning is the safer way.

How does Clean House handle Docker?

Clean House recognizes Docker as developer data and lists Docker.raw in the Dev Desk room with a "Why?" card explaining that it holds your images, containers and volumes. Because deleting the file would remove the whole Docker environment, it won't call it safe blindly; it is a Look first item. For routine cleaning, the prune commands above stay the right tool, since Docker knows what is unused and Clean House does not look inside the image.

See also how to free up space on a Mac and what System Data is.

Questions

Is it safe to delete Docker.raw?

Only if you are fine losing every image, container and volume. Docker.raw is the whole Docker environment, including database volumes. Prune inside Docker first, and reset Docker Desktop instead of deleting the file by hand.

Does docker system prune delete volumes?

Not by default. Docker's docs say it removes stopped containers, unused networks, dangling images and unused build cache. Volumes are included only with the --volumes flag, which can delete data you want.

Why is Docker.raw so big in Finder?

Finder and some tools show the file's maximum size, not the space it really uses on disk. Docker's FAQ gives a 64 GB maximum and about 2.3 GB actually used as an example. Check real use with ls -klsh.

Why did Docker.raw not shrink after I deleted images?

Docker's documentation says space is freed when images are deleted, and it can take a few minutes to return to the Mac. Deleting files inside a running container does not free space.

What happens if I lower the disk image limit?

Docker's docs say lowering the size limit deletes the current disk image, so all containers and images are lost. Prune and back up what you need first.

Sources

  1. Docker Docs: docker system prune
  2. Docker Docs: Docker Desktop for Mac FAQs
  3. Docker Docs: Docker Desktop settings