Where does Docker keep images/containers so i can better track my disk usage

After creating and removing many images my Docker.qcow2 becomes very large. I found a solution how to shrink it. It creates new image based on the old and reduces unused space. This works for me:

cd ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux
/Applications/Docker.app/Contents/MacOS/qemu-img convert -O qcow2 Docker.qcow2 Docker2.qcow2
mv Docker2.qcow2 Docker.qcow

There is also “-c” switch which adds compression to the image but my docker daemon is not able to run with it.

4 Likes