Description
Tell us about your request
I'd like a simple way to compact my Docker.raw disk
Which service(s) is this request for?
Docker Desktop
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
The docker volume will grow over time due to build cache and many images. Sometimes you'd like to reclaim free space back to your primary OS. Right now there is no easy way to do that.
Are you currently working around the issue?
Fully deleting my Docker disk image and starting from scratch.
Additional context
If possible it would be great to just shrink the existing volume. If not, then creating a new volume and copying over data from the "old" volume to the "new" volume and then deleting the "old" volume would work too.
Please make this a simple action available from within the Docker Desktop UI. I'd also accept something like docker system compact
Using docker system prune
is not sufficient as it only cleans up the internal state of the disk, but the actual disk image on your OS remains the same size.
Activity
C4J commentedon Jan 10, 2025
I agree - it seems a basic function which should be included. As a consequence of the Malware issue with Docker for Mac this week (out of date code signing) I ended up loosing my docker. I reinstalled and got everything working again only to find out that docker had created a 1TB docker.raw when in fact I could manage with 100gb. This means I've got to start again as there is no way to shrink the files. I use docker with SQL2022 and Oracle 19 on a Apple Silicon Mac.
C4J commentedon Jan 11, 2025
Actually I think there is an opportunity here. Add an option to the desktop to export/backup everything in docker (settings containers images etc). Then add an option restore the same backup. This would permit you to backup, recreate a resized docker.raw and then import back into it. It also provides a simple and easy way to create a simple and complete backup option which makes the process of replicating docker on a new computer easy. I have a second laptop which I keep synced for disaster recovery.