Skip to cookie settings

Docker disk space on Mac: Docker.raw, images and build cache explained

Docker keeps everything in one large disk image. Here is what fills it, how to see the real numbers, and which parts are safe to remove.

Docker takes up a lot of space on a Mac because it keeps everything in one large disk image: images, containers, volumes and build cache. It does not clean up after itself, so the pile only grows until you review it. The good news is that most of it can be pulled or built again.

This guide is the overview. It shows where the space goes, how to see it with one read-only command, and which parts are safe to remove. The detailed articles linked below cover each step.

Where Docker keeps its data on a Mac

Docker runs Linux containers, and a Mac does not run Linux natively. So Docker starts a small Linux virtual machine and keeps its files in a disk image on your Mac. The Docker Desktop for Mac FAQ says it “stores Linux containers and images in a single, large ‘disk image’ file in the Mac filesystem”. It gives the usual location as ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw.

Other tools do the same in their own place. Colima, a popular alternative to Docker Desktop, keeps its data under ~/.colima by default, according to its FAQ. The Docker.raw guide explains why this one file can look huge in Finder, and the Colima guide covers that tool.

What fills the disk image

Four things take space inside it:

  • Images. The templates containers start from. Every version you pull is stored, and old versions stay after you pull a newer one.
  • Containers. A container is a running or stopped copy of an image. Stopped containers keep their files and logs until removed.
  • Volumes. Storage that outlives containers, often used for databases.
  • Build cache. Layers saved so the next build is faster. The build cache guide covers it.

See the real numbers first

Before you remove anything, ask Docker what it holds. This command is read-only:

docker system df

It prints one row each for images, containers, local volumes and build cache, with a total size and a reclaimable amount. Add -v for a per-item list. Docker’s own Mac FAQ points to this command (with -v) as the first step in reclaiming space.

Treat “reclaimable” as a hint, not a promise. It tells you what Docker would consider unused right now. It does not tell you whether you still want it.

Safe, risky, never

Item Verdict What breaks if removed Cost to recreate
Stopped containers you no longer need Safe Their logs and any files written inside them Start a new container from the image
Dangling images (untagged leftovers) Safe Nothing you run today Rebuilt or pulled again when needed
Unused tagged images Mostly safe A project that needs it pulls it again next time Re-download time, sized by the image
Build cache Safe The next build is slower A longer first build, plus re-downloaded base layers
Volumes Risky Database and app data stored in them is gone May be impossible without a backup
The whole disk image, deleted by hand Never Every image, container and volume at once Everything, from scratch

Docker’s pruning guide describes a separate prune command for containers, images, volumes and build cache. It notes that volume pruning removes anonymous volumes by default and that named volumes need an extra option. Read each command’s prompt before you confirm.

Why deleting inside Docker may not shrink the file

You remove images and Finder still shows a big file. That is normal. The disk image is a sparse file: its maximum size and the space it really uses are two different numbers. Docker’s Mac FAQ shows how to compare them with ls -klsh Docker.raw, and its example lists a 64 GB maximum next to a much smaller real size.

Whether freed space goes back to the Mac also depends on the tool and its version. The Colima FAQ, for example, says unused disk space in its VM is released on startup for version 0.5.0 and above. The reclaim guide walks through the options for Docker Desktop.

A calm order of operations

  1. Run docker system df and note the biggest row.
  2. If it is build cache or stopped containers, start there. Both are cheap to recreate.
  3. For images, look at the per-item list from docker system df -v and remove the ones you recognise as old versions.
  4. Leave volumes alone until you know what is in each one.
  5. If Finder still shows a large file afterwards, read the Docker.raw guide.

Container logs

A container’s logs are stored too, and by default they are not rotated. See Docker container logs filling your disk if one container has been running for months.

How DiskJoy fits in

DiskJoy is our product, so weigh this accordingly. It is pre-alpha: it scans your disk and shows what is reclaimable, and it is built to report the space a file really uses rather than the size Finder shows. Cleanup is not built yet, so it does not remove anything today, and it does not remove Docker data. If you want to see where the space on your Mac went before you open Terminal, check the download page for the current status of the scan.

Frequently asked questions

Why does Docker take up so much space on my Mac?

Docker stores images, containers, volumes and build cache in one Linux virtual machine disk. Every image you pull and every build you run adds to it, and old items stay until you remove them.

Is it safe to delete Docker images?

Images you can pull or build again are safe to remove. The cost is the re-download or rebuild time. Volumes are different: they can hold database data that cannot be recreated.

Does Docker free space automatically?

No. Docker keeps unused images, stopped containers and build cache until you remove them, and the pruning guide in Docker docs describes each prune command separately.

More in Docker

Tags:DockerDocker.rawBuild cache

See what’s taking up space on your Mac

DiskJoy explains every item and removes nothing until you review it.
Download for Mac

Cookies on diskjoy.com

Your browser sends a Global Privacy Control signal. We honoured it: analytics and marketing cookies are off.

Necessary cookies run this site. Analytics shows us how it is used: if you accept it, Google receives data about your visit. Change this anytime in Cookie Settings. How Google uses data Cookie Policy Privacy policy

Customize

Purpose
Needed for the site to work and to remember your cookie choice.

Cookies

  • sy_consent - Stores your cookie choice (Retention: 12 months)

Other browser storage

  • sy_consent_pending (localStorage) - Queues your choice until it reaches our server (Retention: until deleted)
Purpose
Show us which pages are visited and how the site is used, so we can improve it. Provider: Google Ireland Ltd (Google Analytics 4).

Cookies

  • _ga - Distinguishes visitors to count them (Retention: 400 days)
  • _ga_TP2XMLG27P - Keeps the state of your current visit (Retention: 400 days)

Recipients

Data controller

Sylentis Group sp. z o.o.. Contact: support@diskjoy.com. Privacy policy

Google may process data outside the European Economic Area (EEA). Safeguards: EU-US Data Privacy Framework, standard contractual clauses.

Right to withdraw

You can withdraw consent at any time, as easily as you gave it. Withdrawal does not affect the lawfulness of processing before it.