Many times I stuck in situation when Docker consumes whole 70Gb, then I remove all Containers and Images in Docker, and only Volumes remaining which should consume ~7Gb. But storage is not free anymore. Hard to say what is using it. It can probably be just reserved by and not released. Found the way to backup volumes, drop virtual machine, create new and restore volumes.
- To create backups - create file from example below and run that:
chmod +x backup_volumes.sh
./backup_volumes.sh
- Quit Docker Desktop
- Delete the
Docker.raw
file
rm ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
-
Restart Docker Desktop.
- It will create a fresh Docker.raw (~1β2 GB).
- All images, volumes, and containers will be gone.
-
To restore from backups - create file from example below and run that:
chmod +x restore_volumes.sh
./restore_volumes.sh