What is Docker.raw, and how do you shrink it safely?

Docker.raw is the one large file where Docker Desktop for Mac stores all your images, containers and volumes, so clean up inside Docker with docker system prune instead of deleting the file.

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

Docker.raw is the single disk image file where Docker Desktop for Mac keeps every image, container and volume. Look first. Never delete the file while Docker runs. Clean up inside Docker with docker system prune, which frees space for Docker but may not shrink the file on your Mac right away.

Path
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
What it is
The virtual disk of Docker Desktop's Linux VM, holding images, containers, volumes and build cache
Typical size
Often tens of gigabytes; Docker sets a maximum disk image size, and the file can show that maximum in Finder
Made by
Docker Desktop
Safe to delete?
Look first
Comes back?
Images and build cache download or rebuild; volumes (databases) do not come back

What is in this folder?

Docker runs Linux in a small virtual machine on your Mac, and this file is that machine's disk. Everything Docker stores lives inside it: images you pulled, stopped containers, build cache and named volumes. Docker's documentation notes the disk image has a maximum size, and some tools report that maximum rather than the space actually used. du -sh on the file shows the real size.

Because the file is one blob, Finder cannot tell you what is inside. Only Docker can.

Is it safe to delete?

Not as a file. Deleting Docker.raw destroys everything in Docker, including volumes, where databases and uploaded data often live. Images and build cache can be pulled or built again, but volume data cannot be recovered.

Inside Docker, much of it is reclaimable. Unused images, stopped containers and old build cache are safe to prune. Volumes need a look first.

How do I clear it by hand?

  1. Start Docker Desktop and see what is using space.
  2. Prune unused data. By default this removes stopped containers, unused networks, dangling images and build cache, not volumes.
  3. Add -a to also remove all unused images. Add --volumes only if you are sure no volume holds data you need.
docker system df
docker system prune
docker system prune -a
The Docker.raw file may stay the same size on your Mac after pruning, because the space freed is inside the VM. Docker Desktop settings (Resources, Disk image size) and its Clean / Purge data option change that, but reducing the size limit deletes the current disk image and everything in it.

How do I stop it growing?

Prune regularly, remove unused images and build cache, and keep important data in bind mounts or backed-up volumes.

How Clean House handles it

Clean House rates Docker.raw Look first and points you to docker system prune rather than deleting the file. When Docker is running, it asks Docker for docker system df and shows how many images, containers and volumes are inside and how much of the images are unused. If Docker is not running, it says to start Docker to see what is inside.

Questions

Can I delete Docker.raw on Mac?

Not while Docker runs, and not unless you accept losing every image, container and volume. Use docker system prune instead.

Why is Docker.raw so big?

It is the Linux VM disk holding all images, containers, volumes and build cache, up to the maximum disk image size.

Why did Docker.raw not shrink after docker system prune?

Pruning frees space inside the VM disk. The file on your Mac can stay the same size until Docker Desktop reclaims it.

Does docker system prune delete volumes?

Not by default. It only removes volumes if you add --volumes.

Sources

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