Anatomy of the Docker for Mac virtual disk

In Dockerby Alexander Dobriakov

Experimenting with Docker for Mac (beta), I wanted to look inside the virtual machine running Docker and reclaim unused disk space.
First of all, it stores the virtual disk under ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2.

In the next step, I have copied this file into the folder where a Vagrant Linux VM run, listed content, found a running Docker container and shrunk virtual disk:

Not a lot of science, nevertheless — learned a new tool and now know where to search and what to do if my local Docker is getting occupy too much disk space.

PS: Special thanks to Richard WM Jones for useful tips about guestfs tools and James Coyle for an article Reclaim disk space from a sparse image file (qcow2/vmdk)