Skip to content

Why Docker.raw is so large, and how to shrink it

Docker Desktop keeps images, containers, volumes and build cache in one disk image. Why it looks so large, what it really takes, and how to free space in it.

Updated · 3 min read

Docker Desktop runs your containers inside a Linux virtual machine, and that machine's whole disk is one file: ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw. Every image you pull, every container, every volume and the build cache live inside it.

Two things make it confusing: its size often looks far larger than the space it takes, and deleting things in Docker doesn't always seem to free anything.

Why its size looks alarming

Docker.raw is a sparse file. Its size is the most its disk can hold, not what's written to it, and Finder and other tools often show that maximum, even when Docker uses a fraction of it. The space it really takes on your Mac is what's written inside, and it grows as you pull and build images and create containers and volumes.

So before doing anything, look at what Docker itself holds: the Images, Containers and Volumes views in Docker Desktop's dashboard list what takes space.

Don't delete Docker.raw

Moving Docker.raw to the Trash removes every image, container and volume at once, including databases and other data you keep in volumes. Docker Desktop then creates an empty disk. It's the one move to avoid unless you really want to start over. To keep the disk somewhere else, don't move it in Finder either: Docker Desktop's Settings › Resources › Advanced has Disk image location for that.

Freeing space inside Docker

Clear what you don't need through Docker, and it gives the space back to your Mac by itself, sometimes after a few minutes:

  • Images: in the Images view, show the unused ones, check those you don't need and click Delete. The view shows how much space that frees. Images download again when you next need them.
  • Containers: in the Containers view, check stopped containers you don't need and delete them. Files written inside a container, rather than in a volume, go with it.
  • Volumes: delete only the volumes you're sure about, in the Volumes view. They hold data such as local databases, and nothing brings that back.
  • Build cache: Docker Desktop's dashboard has no button for it. Docker's own command-line tool clears it, and the app runs that command for you (below). Your next builds take longer while it fills again.

Deleting files inside a running container usually gives nothing back to your Mac.

Limiting how large it can grow

In Docker Desktop, open Settings › Resources › Advanced and lower Disk usage limit. Be careful: lowering it deletes all containers and images. It's a way to start smaller, not a way to shrink what you have.

OrbStack, Colima and other alternatives

OrbStack keeps its Docker data and Linux machines in one sparse disk image too, which can show a size of several terabytes and shrinks by itself when you delete data in OrbStack. Colima keeps each profile's virtual machine in ~/.colima/_lima and gives unused space back when it starts. In both, delete containers, images and volumes in the tool itself.

How the app does it

The app measures Docker.raw by the space it takes on disk, not the size it claims, and shows both. Select it in the Overview's map or list, and the inspector says what it is and why deleting it is the move to avoid.

The Cleanup page lists it as Usually safe, so it never starts checked. The app never moves Docker.raw to the Trash. When you check it, it runs Docker's own cleanup for the build cache after the review sheet, which shows the size as "up to" because the command frees only part of the disk. Docker Desktop must be running. Images, containers and volumes stay: remove those in Docker Desktop, as above. OrbStack's and Colima's machines are explained, and left to those tools.

What the app runs, after you review itPRO

docker --context desktop-linux builder prune --force
Docker's build cache

Seeing what Docker.raw takes is free. Running its cleanup is PRO.

Safe to delete?

The entries this guide is about, in the words the app shows. Each has its own page with its sources.

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

    Docker Desktop disk image (Docker.raw)

    The virtual disk where Docker Desktop keeps all your images, containers, volumes and build cache.

    Usually safe · Runs docker --context desktop-linux builder prune --force

  • ~/Library/Group Containers/HUAQ24HBR6.dev.orbstack/data

    OrbStack data

    The disk image that holds OrbStack's containers, images, volumes and Linux machines.

    Review first · Explained only: the app shows you how

  • ~/.colima/_lima

    Colima virtual machines

    The Linux virtual machines Colima runs containers in, with their disks and container data.

    Review first · Explained only: never removed