# Docker disk space on Mac: reclaim it safely

Canonical page: https://shedi.app/guides/docker-disk-space-mac

Why Docker Desktop uses so much disk on a Mac, how to see it with docker system df, which prune commands are safe, and why volumes need care.

By **Otabek Abdiraimov** Updated 18 Oct 2026 7 min read

**Short answer**

Docker Desktop on a Mac keeps every image, container, volume and build cache inside one disk image file, so run `docker system df` to see what's inside it. `docker image prune -a`, `docker container prune` and `docker builder prune` free most of the space and only remove things Docker can pull or rebuild. Treat volumes separately: they hold data such as databases, and pruning them deletes that data for good.

Docker's own commands are below. For apps that include Docker in a wider cleanup, see [eight ways to clean Docker, Xcode and node_modules off a Mac](https://shedi.app/compare/best-mac-cleaner-for-developers).

## Check your Mac in one command

To see how Docker compares with your other developer caches before you delete anything, run [diskreceipt](https://shedi.app/guides/diskreceipt). It's a free Terminal tool that prints every developer cache with its size, a safe, check or keep label and the command to clean it. It only reads.

Terminal

```
$ brew install abdiraimov-otabek/tap/diskreceipt
$ diskreceipt
```

## Why does Docker use so much space on a Mac?

Docker containers need a Linux kernel, so Docker Desktop runs a small Linux virtual machine. Docker's documentation puts it this way: Docker Desktop "stores Linux containers and images in a single, large 'disk image' file in the Mac filesystem". By default that file is:

Terminal

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

It's a sparse file: it has a maximum size, but only uses the space actually written into it. Finder may show the maximum, which is why people panic. To see the real number:

Terminal

```
# the first column is the space actually used on disk
$ ls -klsh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
```

You can also see the path in **Docker Desktop > Settings > Resources > Advanced**, under **Disk image location**.

The space inside grows with every image you pull, every build layer, every stopped container and every volume. On a Mac that builds images regularly it's easy to reach tens of gigabytes, and Docker doesn't clean up after itself unless you ask.

## How do I see what's using Docker's disk space?

Terminal

```
# summary: images, containers, local volumes, build cache
$ docker system df

# the same, item by item
$ docker system df -v
```

The **RECLAIMABLE** column is the useful one: it's what Docker could remove without touching anything in use right now.

**Shedi cleans Docker with Docker's own commands** Unused images, stopped containers and build cache are listed with their sizes; volumes are shown separately as your files. Nothing runs until you press Clean.

[Get Shedi](https://shedi.app/#pricing)

## Which Docker prune commands are safe?

Run these one at a time so you know what each one freed. Each asks for confirmation (add `-f` to skip the prompt), and none of them uses the Trash: what they remove is gone, though everything except volumes can be pulled or rebuilt.

**Stopped containers.** Containers you've exited but not removed. Their writable layer, including any files written inside the container (not in a volume), is deleted.

Terminal

```
$ docker container prune
```

**Images.** Without flags, this removes only dangling images (untagged layers left behind by rebuilds). With `-a`, it removes every image that no container uses, including ones you pulled on purpose.

Terminal

```
# dangling images only
$ docker image prune

# every image not used by at least one container
$ docker image prune -a
```

**Build cache.** Layers cached by `docker build` and BuildKit. Often the biggest single item on a Mac that builds a lot. Without flags it removes dangling cache; `-a` removes all unused build cache.

Terminal

```
$ docker builder prune
$ docker builder prune -a
```

**Networks.** Tiny, but tidy:

Terminal

```
$ docker network prune
```

All prune commands accept a filter if you only want to remove older things:

Terminal

```
# only images unused for more than a week
$ docker image prune -a --filter "until=168h"
```

Safe

Images, stopped containers, build cache and networks all come back: you pull or rebuild them. The cost is time and bandwidth the next time you build.

## What about docker system prune -a?

`docker system prune` runs most of the above at once. Docker's reference describes it as removing "all unused containers, networks, images (both dangling and unused), unused build cache, and optionally, volumes". The flags matter:

| Command | Removes |
| --- | --- |
| `docker system prune` | stopped containers, unused networks, dangling images, unused build cache |
| `docker system prune -a` | the above, plus every image not used by a container |
| `docker system prune -a --volumes` | the above, plus anonymous volumes not used by a container |

Check first

`docker system prune -a` is convenient but blunt. It removes base images you may need offline, images for projects that aren't running right now, and all build cache, so your next builds start from scratch. Run `docker system df` first and decide whether the separate commands above are a better fit.

## Why are Docker volumes different?

Volumes are where containers keep data that should survive the container: a local Postgres database, uploaded files, a search index. Docker's docs note that a volume's contents "exist outside the lifecycle of a given container". That's the point of them, and it's why you should never prune them on autopilot.

Terminal

```
# all volumes
$ docker volume ls

# volumes not used by any container
$ docker volume ls -f dangling=true

# remove one specific volume you've checked
$ docker volume rm <volume-name>
```

`docker volume prune` removes unused volumes. In current Docker versions it only removes anonymous volumes by default; adding `-a` also removes named volumes that no container uses, which is where local databases usually live.

Check first

Removing a volume deletes its data permanently. If there's any chance you need it, back it up first; Docker's volume documentation shows how to archive a volume to a tar file with a temporary container.

## How do I shrink or limit the Docker disk image?

Pruning frees space inside the disk image, and because the file is sparse, your Mac usually gets that space back. If it doesn't seem to, Docker's Mac FAQ suggests this command to reclaim space after deleting files:

Terminal

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

To cap how big the disk image can grow, open **Docker Desktop > Settings > Resources > Advanced** and set the **Disk usage limit**.

Check first

Docker's Mac FAQ warns that when you reduce the maximum size, "the current disk image file is deleted, and therefore, all containers and images are lost". Volumes live in the same image. Back up anything you need before lowering it.

## Why does Docker fill up again so quickly?

Pruning is maintenance, not a cure. A few habits decide how fast the space comes back:

- **Rebuilding often.** Each `docker build` after a dependency change creates new layers, and the old image becomes dangling. Build cache grows with every variation of every Dockerfile you build.
- **Many projects, many base images.** Each project pulling its own `node`, `python` or `postgres` tag adds a few hundred megabytes to a few gigabytes. Sharing base image versions across projects where you can helps.
- **docker compose up without down.** Stopped containers and their anonymous volumes accumulate. `docker compose down` removes a project's containers and networks; `docker compose down -v` also removes its volumes, so use that only when you're sure the data is disposable.
- **Multi-platform builds.** Building for both `linux/amd64` and `linux/arm64` stores layers for each.

Checking `docker system df` once a month, and running `docker builder prune` when the build cache line gets large, keeps most Macs in check without ever touching volumes.

## What should I avoid?

- **Deleting Docker.raw in Finder.** It destroys every image, container and volume at once. Prune inside Docker, or use Docker Desktop's own reset options, so you decide what goes.
- **docker volume prune -a without looking.** That's how local databases disappear.
- **Pruning right before a flight.** `-a` removes images you may not be able to pull offline.

If you use another Docker runtime (OrbStack, Colima, Rancher Desktop), the `docker` commands above work the same, but the disk image lives somewhere else; check that tool's documentation for its location.

## A sensible routine

Terminal

```
$ docker system df
$ docker container prune
$ docker image prune -a --filter "until=168h"
$ docker builder prune
$ docker system df   # compare
```

Volumes: review with `docker volume ls` and remove individually. Docker is one of three usual suspects on a developer Mac; the others are [Xcode](https://shedi.app/guides/clear-xcode-deriveddata) and [node_modules](https://shedi.app/guides/delete-node-modules), and the [full cache reference](https://shedi.app/guides/developer-caches-macos) covers the rest. Shedi runs the same Docker commands for you, after showing exactly what each one will remove; Docker's disk image itself is never deleted directly.

## Sources

- [Docker Docs: Prune unused Docker objects](https://docs.docker.com/engine/manage-resources/pruning/)
- [Docker Docs: docker system prune](https://docs.docker.com/reference/cli/docker/system/prune/)
- [Docker Docs: docker builder prune](https://docs.docker.com/reference/cli/docker/builder/prune/)
- [Docker Docs: Volumes](https://docs.docker.com/engine/storage/volumes/)
- [Docker Docs: docker compose down](https://docs.docker.com/reference/cli/docker/compose/down/)
- [Docker Docs: Docker Desktop for Mac FAQ](https://docs.docker.com/desktop/troubleshoot-and-support/faqs/macfaqs/)
- [Docker Docs: Docker Desktop settings](https://docs.docker.com/desktop/settings-and-maintenance/settings/)

## Questions

### Is docker system prune safe?

It's safe for your data by default: it removes stopped containers, unused networks, dangling images and unused build cache, and it leaves volumes alone. With -a it also removes every image not used by a container, which you'll have to pull or rebuild later. With --volumes it also removes anonymous volumes not used by any container.

### Why is Docker.raw so big on my Mac?

Docker Desktop keeps all Linux images, containers, volumes and build cache inside one disk image file. Finder can show its maximum size rather than the space it really uses; ls -klsh Docker.raw in its folder shows both. Space inside it only frees up when you delete images, containers or cache through Docker.

### Can I delete Docker.raw to free up space?

Only if you're willing to lose every image, container and volume at once. It's better to prune inside Docker, or reset Docker Desktop from its own settings, so you decide what goes.

### Does deleting a Docker volume delete data?

Yes. Volumes are where containers keep data that should outlive them, such as a local database. Removing a volume deletes that data permanently, so back it up or confirm you don't need it first.

## Keep reading

[GuideFree up space on Mac without losing anything Where Mac storage really goes, which built-in macOS tools to use first, which developer folders are safe to clear, and what you should never delete.](https://shedi.app/guides/free-up-space-on-mac)[ReferenceDeveloper caches on macOS you can safely delete Every developer cache on a Mac in one table: exact paths, typical sizes, whether it's safe, whether it comes back, and the official clean command.](https://shedi.app/guides/developer-caches-macos)[GuideDelete node_modules safely and free up space Find every node_modules folder on your Mac, delete the ones you don't need, clear npm, pnpm, Yarn and Bun caches, and see why pnpm frees less.](https://shedi.app/guides/delete-node-modules)
