How to clear the Docker cache on a Mac with docker prune
Docker Desktop stores containers and images in one large disk image file, and it does not free up unused space automatically. Below are the Docker commands, checked on 25 Nov 2026, from the most gentle to the one which removes everything.
Updated
First, see what Docker is using
There is a command provided by Docker that breaks down its space. Docker Docs
Usage
Images, containers, volumes, and build cache size:
docker system df -vClear it, from least to most
You will be asked before deleting anything. Docker Docs
1. Build cache only
Clean only build cache:
docker builder prune2. Items left hanging
Removes stopped containers, unused networks, dangling images and build cache. When --volumes is used, volumes will be also removed.
docker system prune3. Images no container uses.
To remove all images not used by any container use -a flag
docker system prune -a4. Everything.
Docker Desktop Troubleshoot and Clean up data will delete all containers and images on your Mac but preserves your settings.
Where Docker keeps it
It's all in one file, and Finder can show it larger than the space it really uses.
The disk image
In Settings, Resources, Advanced, Docker shows where the file is, its max size, and how much it is using. Docker states that the file should not be moved in Finder.
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.rawIts real size
Docker says that some tools report the maximum file size instead of the amount of space taken, and has provided an example to use with ls -klsh Docker.raw to see how much space the file actually took.
Questions about clearing Docker's cache
How do I clear the Docker cache on a Mac?
The docker system prune command removes all stopped containers, all networks not used by at least one container, all dangling images, and all build cache. Use docker builder prune to remove only the build cache.
Does docker system prune remove volumes?
Docker will not touch the volumes unless you use the --volumes option.
Why is Docker.raw so big?
Docker notes that many tools will show the maximum size of the file, not the size the file is actually consuming. Docker also notes that deleting a file from a running container does not always free up space.
See what else is taking up space on your Mac.
DiskKind Free will show you developer folders, like Docker's, and the tool that made each one. It only moves the files you want to the Trash.
