What Docker.raw is
Docker on a Mac runs inside a small Linux virtual machine. That machine needs a disk, and Docker Desktop stores it as a single file called Docker.raw. By default it lives here:
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.rawYou can confirm the location in Docker Desktop under Settings > Resources > Advanced, in the Disk image location field. Everything Docker stores sits inside this one file:
- Images you pulled or built, including old versions and untagged (dangling) layers.
- Containers, running and stopped, with any files written inside them.
- Volumes, which often hold database data for local development.
- Build cache from
docker build, which can be large on its own.
Why the size in Finder can look wrong
Docker.raw is a sparse file. It has a maximum size, set by Docker Desktop, but it only uses disk blocks for data actually written. Some tools show the maximum, so a 64 GB file might really be using far less. To see the real space used, run this in Terminal from the folder above. It only reads.
ls -klsh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.rawThe first number is the space actually used on disk. The larger number later in the line is the maximum size. If the first number is what is hurting you, read on.
See what is using the space
Docker Desktop must be running for these commands. This one prints a summary by type, with a Reclaimable column that estimates what you could free:
docker system dfFor a breakdown by individual image, container and volume, add -v:
docker system df -vLook at the volumes section in particular. A large volume is usually a database or an upload folder you might want to keep.
What is safe to remove, and what it costs
- Stopped containers: usually safe. You can recreate them from their image. Any files written inside a container, outside a volume, are lost.
- Dangling images: safe. These are untagged layers left over from rebuilds.
- Unused images: safe but costly. Docker downloads or rebuilds them the next time you need them.
- Build cache: safe but costly. Your next builds run from scratch and take longer.
- Volumes: not safe by default. A volume can be the only copy of a local database. Check before removing any.
Step by step: give the space back
1. Remove unused data with docker system prune
By default, docker system prune removes stopped containers, networks no container uses, dangling images and unused build cache. It does not touch volumes. It asks for confirmation before deleting anything, and the deletion can't be undone.
docker system pruneTo also remove every image that no container is using, not just dangling ones, add -a. This frees more space, but you will download or rebuild those images again later.
docker system prune -a2. Clear build cache on its own
If docker system df shows a large Build Cache line and you want to keep your images, clear just the cache:
docker builder prune3. Deal with volumes carefully
List volumes first with docker volume ls. docker volume prune removes unused anonymous volumes only. Adding --all also removes unused named volumes, which is where development databases usually live. Back up anything you need before running it.
docker volume pruneTo remove one specific volume you are sure about, use docker volume rm followed by its name.
4. Check that the space came back
Run the ls -klsh command again. Docker's documentation notes that space isn't always freed right away when files are deleted inside running containers. If the file hasn't shrunk after a few minutes, quit and reopen Docker Desktop, then check again.
5. Lower the maximum size or move the file
Under Settings > Resources > Advanced you can set how much disk Docker may use, or move the disk image to an external drive. Move it with the Disk image location setting, never by dragging the file in Finder, or Docker Desktop loses track of it. Docker warns that lowering the disk size deletes the current disk image, so every container and image is lost.
The nuclear option
If you don't need anything inside Docker, open Docker Desktop, click the Troubleshoot (bug) icon and choose Clean up data. Docker's documentation says this destroys all local containers and images while keeping your settings. Volumes go with it. Use this only when you are sure you can rebuild or re-pull everything.
What not to do
- Don't delete Docker.raw in Finder. It frees the space, but it throws away every image, container and volume at once, including databases you might not have backed up. Use the commands above, or Clean up data if you really want a fresh start.
- Don't run prune commands blindly in a project with a local database. Check
docker system df -vanddocker volume lsfirst. - Don't forget other container apps. OrbStack, Colima, Podman and virtual machine apps such as UTM and Parallels keep their own disk images. Clean those up from inside each app.
Docker's disk image is often counted under System Data or Developer in macOS Storage settings. If that category is large, this guide to System Data covers the other usual causes. Developers also tend to have large Xcode folders and node_modules folders worth checking.
Seeing it next to everything else
The Docker commands are the right tool for cleaning inside Docker. What they don't show is how Docker compares with everything else on your disk. freedisk.space scans your Mac and lists Docker's data in its Developer Storage view, alongside Xcode, node_modules and package caches, so you can decide where to start. Docker's disk image is marked for review rather than as reclaimable. If you stage it for cleanup anyway, the Cleanup list warns that moving it to the Trash damages Docker's data and shows docker system prune -a as the alternative. The app never runs Docker commands itself, and nothing moves to the Trash until you confirm.
Questions people ask
- Can I delete Docker.raw on my Mac?
- You can, but it deletes every Docker image, container and volume at once, including any local databases. Use docker system prune to free space inside it, or Clean up data in Docker Desktop if you really want an empty disk.
- Where is Docker.raw stored?
- By default it is in ~/Library/Containers/com.docker.docker/Data/vms/0/data. Docker Desktop shows the exact location under Settings > Resources > Advanced.
- Why is Docker.raw 64 GB when I have few images?
- Docker.raw is a sparse file, so some tools show its maximum size instead of the space it really uses. Run ls -klsh on the file: the first number is the actual usage.
- Does docker system prune delete volumes?
- No. By default it removes stopped containers, unused networks, dangling images and unused build cache, and leaves volumes alone. Volumes are removed only with docker volume prune or the --volumes option.
- Why didn’t Docker.raw shrink after pruning?
- Freed space inside the disk image is not always returned right away. Check again with ls -klsh after a few minutes, and quit and reopen Docker Desktop if it still has not changed.
- How do I limit how big Docker Desktop can grow?
- Set the disk usage limit under Settings > Resources > Advanced. Docker warns that lowering it deletes the current disk image, so all containers and images are lost.