1. Measure Docker’s actual usage
Docker Desktop stores Linux containers and images inside a disk image. A large apparent Docker.raw size is not necessarily the amount of Mac storage occupied: sparse files can report a maximum size larger than their allocated space. Use Docker Desktop’s storage settings and compare available Mac space before choosing a target.
With Docker running, the read-only command docker system df -v reports detailed usage by object type. Also inspect docker container ls -a and docker image ls, which list containers and images without deleting them. Confirm you are connected to the intended Docker context, especially if you also work with remote engines.
docker system df -v
docker container ls -a
docker image ls2. Separate rebuildable objects from retained data
A downloaded image may be easy to fetch again. A locally built image may require source files, build secrets and access to an old dependency registry. A stopped container can still hold files in its writable layer. “Stopped” describes its running state; it does not establish that its contents are disposable.
Volumes commonly hold databases, uploads and other persistent state. Identify the application behind each volume before deleting anything. If the data matters, use the application’s backup procedure and verify the backup. Copying a database’s live files is not automatically an application-consistent backup.
3. Review objects in Docker Desktop
Open the Containers view, inspect a project you no longer use, and check its mounts and retained files before selecting its removal action. Then review the Images view for images you can recreate. Docker Desktop’s interface and available controls vary by version, so read each confirmation for the objects affected.
Treat the Volumes view as a separate review. Docker documents inspection and export options there; some actions have account or subscription requirements. A volume named after an abandoned Compose project may still contain your only local database. Keep it until the data is backed up or explicitly no longer needed.
4. Understand prune before using it
Docker’s system prune operation removes several kinds of unused objects, including stopped containers, dangling images, unused networks and build cache. Additional flags broaden its reach. The scoped commands below each remove one kind of object and ask for confirmation first, so you can review stopped containers, dangling images and build cache separately instead of running one bulk prune. None of them removes volumes.
Build cache can save substantial work on the next build. Decide whether recovering that space is worth slower builds and possible downloads. If you choose a prune workflow, consult the official reference for your installed version, check filters and confirmation text, and avoid assuming “unused” means “unimportant.”
docker container prune
docker image prune
docker builder prune5. Check both Docker and the Mac afterward
Repeat docker system df -v and compare available Mac space after Docker finishes reclaiming storage. Host reclamation and Docker object totals answer different questions. Deleting files inside a running container may not immediately shrink the disk image. Do not delete Docker.raw or reduce its maximum size as a casual cleanup shortcut.
Start a retained development stack and check its data. If Docker remains the main storage user, plan retention for old images and build cache around your normal workload. If another folder is larger, investigate it separately; a general disk scan helps locate the source but cannot decide which Docker database you should keep.
Containers: list every one, not only running ones
docker ps shows running containers only, which is why old ones go unnoticed. Add -a to include everything: the STATUS column reads Exited for stopped containers and Created for containers that were never started. Add --size to see two figures per container: the data in its own writable layer, and a virtual size that also counts the read-only image underneath it.
The same list is in Docker Desktop’s Containers view, which shows running and stopped containers together and groups Compose projects under their project name. Each stopped container keeps its writable layer, its settings and its logs until it is removed, so a development Mac that runs many one-off containers can collect a long list.
docker ps -a
docker ps -a --size
docker ps -a --filter "status=exited"Containers: remove specific ones
Pass one or more names or IDs to docker rm. A running container is refused; stop it first with docker stop, which lets the process shut down cleanly. docker rm -f skips that step by sending SIGKILL, which can leave a database mid-write, so keep it for containers you’re sure about. Adding -v also removes the container’s anonymous volumes, while named volumes stay.
To remove only the exited ones, combine docker rm with a filtered list, as Docker’s own reference shows. For a Compose project, docker compose down removes its containers and networks. docker compose down -v also deletes the named volumes declared in the Compose file, so leave -v off unless you mean to delete that data. In Docker Desktop, use the Delete action on a container row.
docker stop old-api
docker rm old-api
docker rm $(docker ps -aq --filter "status=exited")Containers: remove all stopped ones at once
docker container prune removes every stopped container after a confirmation prompt, and prints the IDs it deleted and the space reclaimed. Running containers are never touched. The -f flag skips the prompt; keep it out of habits and scripts you haven’t reviewed.
To keep recent work, add --filter "until=24h". Note what the filter measures: containers created more than 24 hours ago, not stopped more than 24 hours ago, so a long-lived container you stopped this morning still qualifies. Labels work too, and filters with different keys must all match. docker system prune goes further and also removes unused networks, dangling images and build cache.
docker container prune
docker container prune --filter "until=24h"
docker container prune --filter "until=168h"Volumes: list them and find out what they hold
docker volume ls lists every volume. Long hexadecimal names are anonymous volumes, created when an image declares a volume or a container mounts a path without naming it. Readable names are named volumes; Compose prefixes them with the project name, so myproject_db-data belongs to a project called myproject. The dangling filter lists volumes no container references.
docker system df -v includes a Local Volumes section with each volume’s size and how many containers link to it, and docker volume inspect shows labels, such as the Compose project that created it. Docker Desktop’s Volumes view shows the same list with sizes and an In use or Unused status, and lets you browse the files inside a volume.
docker volume ls
docker volume ls --filter "dangling=true"
docker system df -v
docker volume inspect myproject_db-dataVolumes: back up any that hold databases
Volumes exist to keep data after containers are gone, so they often hold the only copy of a local database, uploaded files or test fixtures. Deleting one is permanent: nothing goes to the Trash. If you might need the data, back it up first.
For a database, the database’s own dump tool gives a consistent backup; run it inside the container with docker exec while the database is running. For other data, Docker’s volume documentation shows archiving a volume through a temporary container. Stop containers that write to the volume first. Docker Desktop’s Volumes view can also export a volume to a local file, which requires signing in.
docker exec my-postgres pg_dump -U postgres mydb > mydb.sql
docker run --rm -v myproject_db-data:/data -v "$PWD":/backup alpine tar czf /backup/db-data.tgz -C /data .Volumes: remove one
docker volume rm deletes one or more volumes by name, along with all their data. In Docker Desktop, open Volumes, select the Delete icon on the row and confirm with Delete forever. Both refuse while a container uses the volume.
Docker Desktop’s documentation is explicit that this includes stopped containers: you can’t delete a volume while any container is using it, even if that container is stopped. That rule is behind the most common confusion about volumes. If you want the space back but the volume kept, Docker Desktop can also empty a volume, deleting its data while keeping the volume itself; like export, that requires signing in.
docker volume rm myproject_db-dataVolumes: fix “volume is in use” when nothing is running
The error ends with a list of container IDs: those are the containers holding the volume. docker ps shows only running containers, so they seem not to exist. docker ps -a with a volume filter finds them, stopped ones included. Remove the container, after saving anything in it you need, and the volume can be deleted. Reaching for -f is the wrong fix; the container is the dependency.
Compose projects are the usual source. Stopping a project, or pressing Control-C, leaves its containers in place. docker compose down removes the containers and keeps named volumes; docker compose down -v removes the named volumes declared in the Compose file as well, so add -v only when you mean to delete that data.
docker ps -a --filter "volume=myproject_db-data"
docker rm 1a2b3c4d5e6f
docker volume rm myproject_db-dataCommon questions
How do I check how much space Docker is actually using on my Mac?
With Docker running, run docker system df -v, a read-only command that reports detailed usage by object type. Also check docker container ls -a and docker image ls to see containers and images without deleting anything.
Why does Docker.raw show a huge size when my Mac isn't actually that full?
Docker.raw is a sparse file, so it can report a maximum size much larger than the space it actually occupies. Compare Docker Desktop's storage settings against available Mac space before treating the reported size as real usage.
Is running docker system prune safe?
It removes several kinds of unused objects, including stopped containers, dangling images, unused networks and build cache, but unused doesn't always mean unimportant, since build cache can save real rebuild time. Review what it would remove before running it.
Can I delete Docker.raw directly to free up space?
No. The guide is explicit that you shouldn't delete Docker.raw or reduce its maximum size as a casual cleanup shortcut. Use Docker Desktop's own views or a reviewed prune workflow to reclaim space instead.
Will removing a Docker container delete data I need?
Yes, it deletes the container's writable layer for good, including generated files, uploads, or a database that was never given a volume, with no undo. Data stored in named volumes survives, since that's what volumes are for.
Will docker volume prune delete my named volumes?
Not by default. On current Docker versions it removes only anonymous volumes; adding -a also removes unused named volumes, which is what can delete the databases of abandoned projects, so list and back up first.
Is deleting a Docker volume permanent?
Yes, docker volume rm deletes the volume and all its data with nothing going to the Trash. Back it up first, for example by running a database's own dump tool while the database is still running.
References & further reading
These guides combine the linked official guidance with ClearDisk’s documented behavior. Your files and app settings determine the right next step.