Developer guide

Docker.raw is huge on your Mac: how to shrink it safely

Find out how much space Docker.raw really uses, then free it in the safe order without losing data.

2 safe2 careful2 never

updated read 4 minfor Docker Desktop for Mac (Apple silicon and Intel)

The short answer

  1. 01

    Docker.raw is one disk image holding all your images, containers, volumes and build cache, at ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw.

  2. 02

    Finder shows its maximum size, not real usage. Check real usage with ls -klsh or Settings > Resources > Advanced.

  3. 03

    Free space from inside Docker: docker system df, then docker system prune. Docker Desktop returns the space to macOS after a few minutes.

  4. 04

    Never delete Docker.raw by hand. It destroys every image, container and volume you have.

  5. 05

    Clean up data or a lower disk usage limit also deletes the disk image and everything in it.

Docker.raw: Finder vs realExample Mac
22.4 GB really used 64 GB in Finder

Finder shows the maximum. ls -klsh and du -h show what the file really uses.

The prune ladderLeast to most destructive
SafeFrees about 4.1 GB
docker builder prune
Removes
  • Unused build cache
Keeps
  • Images, containers, networks and volumes

Builds run slower once.

SafeFrees about 6.8 GB
docker system prune
Removes
  • All stopped containers
  • Networks not used by a container
  • Dangling images
  • Unused build cache
Keeps
  • Running containers
  • Tagged images
  • Volumes

It asks for confirmation. Add -f to skip the prompt.

CarefulFrees about 14.9 GB
docker system prune -a
Removes
  • Everything in step 02
  • Every image that no container uses, not only dangling ones
Keeps
  • Images a running container uses
  • Volumes

Removed images download or rebuild when needed.

CarefulFrees about 17.6 GB
docker system prune -a --volumes
Removes
  • Everything in step 03
  • Anonymous volumes not used by a container
Keeps
  • Named volumes
  • Anything a running container uses

Volumes often hold databases. Check docker volume ls and back up first.

Docker.raw on an example Mac: Finder shows the 64 GB maximum while the file uses 22.4 GB, and each prune step frees more and keeps less.

What Docker.raw is

If Docker.raw is taking up space on your Mac, the cause is how Docker Desktop works. It runs Linux in a virtual machine, and everything Docker stores (images, containers, volumes, build cache) sits in one disk image at ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw. For what else may fill your disk, see the guide to freeing disk space on a Mac.

Why Finder shows a bigger number than reality

The file can report a very large size while using much less. Docker's documentation says the Advanced tab shows both the maximum size and the space actually used, and other tools may show the maximum. Its example is about 2.3 GB used against a 64 GB maximum.

ls -klsh ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw

The first column is the space actually used. The file size column is the maximum. Removes nothing.

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

Reports allocated blocks, so it matches real usage rather than the maximum.

Safe to delete?

ItemVerdictWhat you lose
Build cacheSafeCached layers. Builds run slower once.
Dangling images, stopped containersSafeUntagged images and exited containers. Their logs and writable layers go too.
Unused tagged images (prune -a)CarefulImages with no container. They download or rebuild when needed.
VolumesCarefulDatabase files and other data. Not reproducible unless you have backups.
Clean up data or a lower disk limitNever without a backupThe whole disk image: every container, image and volume.
Docker.raw deleted in FinderNeverSame as above, with no confirmation.

Step 1: see what Docker is using

docker system df

Shows Images, Containers, Local Volumes and Build Cache with total, active, size and reclaimable columns. Removes nothing.

docker system df -v

Adds per-image shared and unique size, so you can see which images matter.

Step 2: prune from least to most destructive

docker builder prune

Removes unused build cache only.

docker system prune

Removes all stopped containers, networks not used by a container, dangling images and unused build cache. It asks for confirmation; add -f to skip the prompt.

docker system prune -a

Also removes every image that no container uses, not only dangling ones.

docker system prune -a --volumes

Also removes anonymous volumes not used by a container. Named volumes are left alone.

Volumes often hold databases. Check docker volume ls before using the volumes flag, and back up anything you cannot recreate. A stopped container's volume is only safe to lose if you are sure nothing will need it.

Step 3: get the space back on macOS

Docker's FAQ says space is freed only when images are deleted, and it may take a few minutes to reach the host. Deleting files inside running containers does not free it. To force it:

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

Runs Docker's reclaim helper so the host sees the freed space.

Docker Desktop settings

  • Settings > Resources > Advanced > Disk usage limit sets the engine maximum. Reducing it deletes the current disk image, so all containers and images are lost.
  • Disk image location moves Docker.raw. Use this, never Finder.
  • Troubleshoot > Clean up data resets the disk image: all local containers and images go, settings stay. Older versions call it Clean / Purge data.

OrbStack and Colima

Other runtimes use other files. OrbStack's data disk is ~/.orbstack/data/data.img. Its FAQ calls it a sparse file that takes only the space you use and shrinks when you delete data, so check it with du -h. Colima keeps VM data under ~/.colima. In both, free space inside the runtime with docker system prune, not by deleting the disk file.

Preview the prune before Docker runs it

Hoardless finds Docker.raw at the path above and reports it as a Confirm-tier item. Its size for this row is the file's reported size, so use ls -klsh above for real usage. It never moves the file to the Trash. Its action runs docker system prune -a --volumes -f, which removes unused images and anonymous volumes, so read the preview first. It also lists images no container uses, with their age, and removes them with docker image rm after you approve. It does not detect OrbStack or Colima.

See Hoardless

Questions

Why is Docker.raw so big?

It is one disk image holding every image, container, volume and build cache. It grows as Docker uses space and shrinks only when Docker frees space inside it.

Is it safe to delete Docker.raw?

Only if you accept losing all images, containers and volumes. Docker Desktop recreates an empty disk. Use Troubleshoot > Clean up data instead of deleting the file in Finder.

Does docker system prune shrink Docker.raw?

It frees space inside the image. Docker Desktop then returns space to macOS, which can take a few minutes. You can force it with docker run --privileged --pid=host docker/desktop-reclaim-space.

Does docker system prune delete volumes?

Not by default. Adding the volumes flag removes anonymous volumes only. Named volumes need docker volume rm or docker volume prune.

What is the difference between prune and prune -a?

The default removes dangling (untagged) images. The -a flag removes every image that no container uses.

How do I check Docker disk usage on a Mac?

Run docker system df, and add -v for per-image shared and unique size. Settings > Resources > Advanced shows actual versus maximum size of the disk image.

Why does Finder show a different size than du?

Finder reports the file's apparent size. du and ls -klsh report allocated blocks, which is what the file actually uses on disk.

Can I move Docker.raw to an external drive?

Yes, with Settings > Resources > Advanced > Disk image location. Never move the file in Finder, because Docker Desktop can lose track of it.

Where does Docker store images on a Mac?

Inside Docker.raw at ~/Library/Containers/com.docker.docker/Data/vms/0/data/, not as separate files. Use docker system df to see what is in it.