Skip to content

Mac cache folders

How to clear the Docker cache on a Mac

By · Updated · 3 min read

Short answer

Run docker system prune to remove stopped containers, unused networks, dangling images and build cache; add -a to remove every unused image. Volumes are kept unless you add --volumes. Don’t delete Docker.raw in Finder; Troubleshoot › Clean up data starts from empty instead.

Where is the Docker cache on a Mac?

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

Check first. All images, containers and volumes; some hold databases. To keep volumes, run docker --context desktop-linux system prune while Docker is open or quit Docker.

How do I clear Docker’s cache from the command line?

  1. 1From the command line, with Docker Desktop running: docker system prune. This removes all stopped containers, all networks not used by at least one container, all dangling images and unused build cache.
  2. 2Add -a (docker system prune -a) to also remove every image that has no container, not just dangling ones.
  3. 3Add --volumes to also prune anonymous volumes not used by a container. Volumes are kept by default.
  4. 4Run docker system df -v first to see what is using space; docker builder prune removes only build cache.
  5. 5To start from empty: click the Docker whale icon in the menu bar, choose Troubleshoot, then Clean up data. This destroys all local containers and images and keeps your settings.

How do I delete the Docker cache by hand?

  1. 1Don't delete or move Docker.raw in Finder. Docker's docs warn that moving it in Finder can make Docker Desktop lose track of it; use Settings > Resources > Advanced > Disk image location instead.
  2. 2Free space with docker system prune (above), then, if macOS still shows the space as used, run: docker run --privileged --pid=host docker/desktop-reclaim-space. It can take a few minutes to free space on the host.
  3. 3To remove everything, quit Docker Desktop and use Troubleshoot > Clean up data, or delete ~/Library/Containers/com.docker.docker (all images, containers and volumes are lost).

What happens when you clear it?

docker system prune deletes all stopped containers, unused networks, dangling images and unused build cache; it asks for confirmation and keeps volumes unless you add --volumes (only anonymous, unused volumes). -a also deletes every image without a container, so the next run pulls them again. Clean up data destroys all local containers and images and keeps settings. Space is freed only when images are deleted, not when files are deleted inside running containers. Lowering the disk image's maximum size deletes the current disk image, so all containers and images are lost.

Clearing it with Peekaboo

Peekaboo’s developer cleanup (turn on Show developer features in Settings) lists “Docker Desktop” with its size and the note above, alongside every other cache it finds. It won’t offer a folder the app is still running from, and the cleanup goes to the Trash, so ⌥⌘Z puts it back.

  1. 1Open the developer cleanup.⇧⌘B
  2. 2Find Docker Desktop, check its size, and move it to the Trash.

Questions

Does docker system prune delete my volumes?

Not by default. Docker's reference says volumes aren't removed, to prevent important data from being deleted. --volumes prunes only anonymous volumes not used by at least one container.

Why does Docker.raw look huge in Finder?

Docker's Mac FAQ says other tools may show the file's maximum size, not its actual size. For example, a file using about 2.3 GB on disk can have a 64 GB maximum.

I deleted images but my Mac didn't get the space back. Why?

Docker's FAQ says space is freed only when images are deleted, not when files are deleted inside running containers, and freeing it on the host can take a few minutes. To force it, run docker run --privileged --pid=host docker/desktop-reclaim-space.

Sources

Your privacy choices

With your permission, Google Analytics measures visits to this site using cookies. Privacy policy.