If you're using Docker on Mac, chances are you have quite a big file tucked in your home directory. Docker.qcow2 file should be located in ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 and if you weren't wary of it's existence, it's probably tens of GBs by now.

In general qcow2 is a file format used by QEMU, which represents a disk image. The upside of using qcow file is that in theory it should expand when necessary. In theory it's also supposed to shrink but it seems that client implementation for Mac's Docker has a bug. One would expect that the image would drastically decrease in size when we remove containers and images, but well... it doesn't.

A while ago I subscribed to a bug on GitHub and unfortunately, after 1 year, there's still no official solution to the problem. A nifty script was written by one of the users and for now, it's a go-to-solution for keeping the disk image within reasonable size. Bear in mind that "clean" image is still ~2GB even if you have no containers or images.

I really don't understand a why it has a copyright or why it's dubbed "software", but in any case it's a sensible script: link to gist

Tags: