Sweepfor Mac

Speed up your Mac

How to Reclaim Speed (and Disk) After Docker Has Been Running

Docker on Mac silently eats RAM and disk via its Linux VM. Here's how to prune images, shrink the VM disk, and recover speed when you're done containerizing.

9 min read

You’re not actively running anything in Docker right now, but you check About This Mac and somehow 80 GB of your SSD is missing. Activity Monitor shows com.docker.virtualization chewing up 6 GB of RAM. The Linux VM that Docker runs under the hood is one of the most expensive things on a developer’s Mac, and most of that cost is invisible until you go looking for it.

Here’s how to clean up Docker properly and get the resources back.

Understand where Docker hides on a Mac

Docker on macOS doesn’t run containers natively. It runs a Linux VM, and inside that VM is everything: images, containers, volumes, build cache. The VM stores its data in:

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

This file grows every time you pull an image, build a new container, or write to a volume. It does not automatically shrink. After a year of dev work, it’s not unusual to see Docker.raw at 100+ GB even when you “don’t have any containers running.”

Skip the manual huntSweep finds the cache and cruft slowing down your workflow. Try Sweep free →

Step 1: prune containers, images, networks, volumes

The first cleanup pass is the standard docker system prune. Read each prompt before confirming.

docker system prune

This removes stopped containers, unused networks, and dangling images (but not volumes by default).

To also remove unused volumes (be careful — this includes named volumes that aren’t currently mounted):

docker system prune --volumes

For the most aggressive cleanup including all unused images, not just dangling ones:

docker system prune -a --volumes

This is the right move if you’re between projects or just want to start fresh. Reclaims dozens of GB on most dev Macs.

Step 2: shrink the Docker.raw file

Pruning frees space inside the VM, but Docker.raw doesn’t shrink automatically. To actually reclaim disk on the Mac:

  1. Open Docker Desktop
  2. Settings (gear icon)
  3. Resources > Advanced (or Disk image size)
  4. Use Clean / Purge data to wipe the VM and start over (nukes everything)

Or for a less destructive shrink, use the disk-image utilities Docker ships:

  • macOS: Settings > Resources > Disk image size has a slider you can set lower (Docker rebuilds the file at the new size on restart)

After this operation, About This Mac > Storage should show real disk space recovered.

Step 3: check resource limits

Docker reserves a fixed amount of CPU and RAM for its VM. Even when no containers are running, Docker allocates this RAM upfront if Docker Desktop is open.

Docker Desktop > Settings > Resources:

  • CPUs: 2-4 is plenty for most dev work; the default is often higher
  • Memory: 4-6 GB is fine for typical microservice work; default may be 8 GB
  • Swap: 1 GB is fine
  • Disk image size: as small as you can tolerate

Lower these and Docker uses less of your Mac’s resources. You can always raise them temporarily for big jobs.

Step 4: stop Docker when you’re not using it

Docker Desktop runs as a tray app and keeps the VM warm. That’s convenient — but if you’re not actively running containers, quit Docker fully.

  • Click the Docker whale icon in the menu bar
  • Quit Docker Desktop

Activity Monitor should show all com.docker.* processes disappear within 30 seconds. RAM comes back. CPU activity drops.

If Docker Desktop autostarts at login: System Settings > General > Login Items and remove it. Launch it manually only when you need it.

Tip: If Docker.raw is huge and Docker keeps misbehaving, the nuclear option is to fully reset Docker Desktop: Settings > Troubleshoot > Clean / Purge Data. You lose all images and containers but recover all the disk and start fresh.

Step 5: clean up build cache

Docker’s build cache (BuildKit, especially) stores intermediate layers from every build. After many docker build runs, the cache can be 20+ GB.

docker builder prune

For a more thorough clean:

docker builder prune -a

The -a removes all build cache, even what’s currently referenced. You’ll have slower next-builds but get the space back.

Step 6: free RAM after Docker quits

Even after quitting Docker, macOS holds the memory it had allocated as “Inactive” — assuming you’ll relaunch Docker soon. To force it free:

  • Sweep’s speed boost frees inactive memory and is the easiest path
  • Or sudo purge in Terminal (requires admin)
  • Or wait — macOS will reclaim it under memory pressure

Activity Monitor’s Memory Pressure should drop back to green within a minute of quitting Docker if there are no other heavy apps running.

Free up RAM in one clickSweep frees inactive memory and pauses runaway processes. Get Sweep free →

Use lighter alternatives when possible

If you’re on a low-RAM Mac and Docker feels heavy, alternatives:

  • Colima — runs Docker via a smaller, more configurable Linux VM (brew install colima)
  • OrbStack — paid alternative that’s much lighter than Docker Desktop, faster, and uses less RAM
  • Native binaries — for Postgres, Redis, etc., installing via Homebrew avoids the Linux VM entirely

For development that touches many services, lightweight Docker substitutes are a meaningful upgrade.

Step 7: review for leftover containerd / k8s data

If you’ve ever experimented with Kubernetes via Docker Desktop or minikube, those leave more state behind:

  • ~/.minikube/
  • ~/.kube/cache/
  • ~/Library/Application Support/com.docker.docker/Data/

If you’re not running Kubernetes locally anymore, these can be cleaned. Sweep’s developer scan flags them for review.

Step 8: deal with bind-mount caches

If you bind-mount a project folder into a Docker container, macOS creates filesystem caches to bridge the difference between APFS and the Linux filesystem. These can grow large:

  • Check ~/Library/Containers/com.docker.docker/Data/vms/0/0/

Docker generally manages this, but if you’ve had trouble with hangs or slow file I/O in containers, it may be worth a clean pass.

A weekly Docker cleanup routine

If you use Docker daily, build this into your weekly maintenance:

  1. docker system prune -a --volumes (read prompts, confirm carefully)
  2. docker builder prune -a if build cache is large
  3. Check Docker Desktop > Settings > Resources, confirm allocations are reasonable
  4. Quit Docker Desktop when you’re done with containers
  5. Sweep cleanup pass to free memory and disk
  6. Confirm Docker.raw is reasonable size in Activity Monitor or About This Mac

A clean Docker setup keeps your Mac responsive even with active containerization. A neglected one slowly suffocates your SSD until you can’t open Photos.

When to fully reset Docker Desktop

If Docker is misbehaving in ways that don’t make sense — long startups, mysterious VM crashes, containers that won’t connect — a full reset is faster than debugging:

  1. Docker Desktop > Settings > Troubleshoot > Clean / Purge data
  2. Docker Desktop > Quit
  3. Reboot
  4. Launch Docker Desktop fresh

You lose all images and containers. You also recover all the disk space and start with a fresh, performant VM. Often well worth the cost for a working dev machine.

← Back to all guides