Guide

Docker system prune on Mac, explained.

On a Mac, everything Docker stores sits inside one disk image. Here's how to see what's in it, what each prune command removes, and why you should never delete the file itself.

The short version

Run docker system prune. It asks first, then removes stopped containers, networks no container uses, dangling images, and unused build cache. Add -a to also remove every image no container is using. Volumes stay unless you add --volumes, and volumes hold data, like your local databases. Docker Desktop keeps all of it in one file, Docker.raw, so reclaim space with Docker's commands, never by deleting that file.

Where Docker stores data on a Mac

Docker Desktop runs Linux in a small virtual machine, and that machine's disk is a single file. Every image you pull, every container, every volume, and all your build cache live inside it.

WhatDefault locationOn one Mac
The disk image~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw29 GB on disk
Images, containers, volumes, build cacheInside Docker.raw; docker system df lists them27.4 GB of images, 15.4 GB unused

Sizes are from one developer Mac in October 2026. Two commands tell you what's really there:

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

docker system df breaks usage into images, containers, local volumes, and build cache, with a RECLAIMABLE column for what nothing is using. Add -v for a line per image and volume.

Why Finder shows a huge number. Docker.raw is a sparse file: its listed size is the most it may grow to, not what it uses. On the Mac above, Finder and ls showed 926 GB while du showed 29 GB. Trust du, or Docker's own numbers.

What docker system prune deletes

By default, docker system prune removes:

  • Stopped containers. Anything you ran and didn't remove. Running containers stay.
  • Unused networks. Networks no container is attached to.
  • Dangling images. Untagged layers left behind when you rebuild or pull a newer tag. Tagged images stay.
  • Unused build cache. Layers BuildKit saved to make the next build faster.

Is it safe? For the default command, yes. Everything it removes can be pulled or rebuilt; the cost is a slower next build. Two flags change that. -a removes every image no container uses, so you'll download them again. --volumes removes unused anonymous volumes, and a volume may be the only copy of a local database. Use it only when you know what's in them.

How to clear Docker cache, flag by flag

docker system prune                 # stopped containers, unused networks, dangling images, build cache
docker system prune -a              # plus every image no container uses
docker system prune --volumes       # plus unused anonymous volumes (data)
docker builder prune                # build cache only
docker builder prune -a             # all build cache, not just dangling
docker image prune -a               # unused images only
docker volume prune                 # unused anonymous volumes only
  • -f skips the confirmation prompt. Leave it off when you type the command yourself.
  • --filter "until=24h" keeps anything created in the last day, which is handy when you want old layers gone but today's builds kept.
  • docker builder prune is the answer to “clear Docker cache” when you mean build cache. It leaves images and containers alone.

If you really want to start over, Docker Desktop's Troubleshoot screen has Clean / Purge data, which erases every image, container, and volume. That's the supported way to empty Docker.raw.

How much disk space Docker uses

It depends on what you pull. A few base images and a database take a few gigabytes; a year of rebuilding multi-stage images can take tens. On the developer Mac above, Docker held 27.4 GB of images, and 15.4 GB of that was unused by any container. Volumes were 2.8 GB, half of it unused.

The file grows up to the disk limit set in Docker Desktop's Settings › Resources. Changing that limit can make Docker Desktop recreate the disk image, which erases everything in it, so read its warning before you apply. Prune first; Docker Desktop hands the freed space back to macOS, though du can take a few minutes to show it.

Don't delete Docker.raw

Moving Docker.raw to the Trash deletes every image, container, and volume at once, and Docker Desktop makes a new empty one. If that's what you want, use Clean / Purge data instead, so Docker does it cleanly.

Docker is also one of the usual reasons System Data looks huge in Storage settings. More caches: every tool's cache, one page each.

Disk Forecast finds this for you

Disk Forecast lists Docker under Cleanup › Worth a look › Docker disk image, sized by what the file really uses. It never moves that file to the Trash. Its Reclaim in System Data… button opens the Docker row in System Data, which shows images, containers, volumes, and build cache, each with how much is unused. Prune unused Docker data… shows you docker system prune -f and runs it only after you confirm. Volumes, running containers, and tagged images stay. It's free.

Questions

What does docker system prune do?

It removes stopped containers, networks no container uses, dangling images, and unused build cache, after asking you to confirm. With -a it also removes every image no container is using, and with --volumes it removes unused anonymous volumes.

Is docker system prune safe?

The default command is. Everything it removes can be pulled or rebuilt, so the cost is time on your next build. Be careful with --volumes: a volume may hold the only copy of a local database.

How do I clear Docker build cache?

Run docker builder prune to remove dangling build cache, or docker builder prune -a to remove all of it. Images and containers aren't touched. The next build takes longer while BuildKit rebuilds its cache.

Where is Docker.raw on a Mac, and can I delete it?

It's at ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw. Don't delete it: it holds every image, container, and volume. Use docker system prune, or Clean / Purge data in Docker Desktop's Troubleshoot screen.

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

Images pile up as you pull and rebuild, and build cache grows with every build. Run docker system df to see which. Finder can also show Docker.raw at its maximum size, because it's a sparse file; du shows what it really uses.

Know before it's full.

Free. No account, no subscription.

macOS 14 or later · Apple Silicon and Intel · brew install --cask coreyhaines31/tap/diskforecast