Qcow2 image maintenance

Expected behavior

The Docker.qcow2 image on my system has grown to over 30GB at the moment.

I tend to keep my downloaded Docker images to a minimum, as I am using a 256GB SSD, and am concerned about disk utilization.

It would be beneficial to have a way to have forced or routine maintenance on that image to shrink the disk utilization.

Actual behavior

Information

OS X: version 10.11.2 (build: 15C50)
Docker.app: version v1.11.1-beta12
Running diagnostic tests:
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160519-093925.tar.gz
Most specific failure is: No error was detected
Your unique id is: C57F9862-9CD4-4AF5-9AE8-8D498F28F15A
Please quote this in all correspondence.

Steps to reproduce the behavior

  1. docker pull a bunch of images
  2. Watch Docker.qcow2 grow
1 Like

The situation you are facing seems to be the same as the one described in these threads:

HTH,
Alexandre

To lessen the impact of an out of control qcow2 file I have placed my in a loopback disk on my mac that has a fixed size.

What I did was create a new disk image using Mac’s Disk Utility and set its size to a value that I felt would be reasonable given my use case (20G). After shutting down Docker for Mac and removing my old qcow2 file (it was bigger than 20G) I then mounted that disk image and linked my disk image to the Docker for Mac qcow2 HD location:

ln -s /Volumes/docker-for-mac\ loopback/hd.qcow2 \
~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 

Now docker for Mac is writing into my disk image. I imagine I will run into a docker failure once the image fills up but at that point intend on doing one of the qcow2 cleanup commands as I should have plenty of space to make a copy of my image.