mac os toolkit
As a developer, I use docker to do my development work a lot on my Mac Air laptop. It's quite annoying that once I pulled some docker images and kicked off some docker containers, the consuming disk space keeps growing even after I try to delete some files to free some space.
So I googled around, then based on the following references, I write some shell scripts to work it out. It did work for me, and I hope it work for you too.
- (David Scott's Blog) Docker for Mac: reducing disk space)
- (StackOverflow) Docker is filling up my disk space
This script will backup your docker images to tar archive files, then delete docker's single writable disk imageDocker.raw
(or Docker.qcow2
), and finally restore the docker images from the previous backup files (and optionally remove the backup files).
You can change the docker preference settings to adjust the maximum docker image size during the process.
This script will do a docker system prune, then trim & reclaim the docker disk image size, and output the pre-reclaim & post -reclaim disk space usage.
This script will re-tag the docker image from image id after restoring the docker images from backup file.