Consistently out of disk space in docker beta

This can happen just from pulling a lot of images and using a lot of containers. It seems the original qcow disk image was smaller. Latest download I ended up with a 64G. Others have some parts of thisin the thread, but here’s an expansion procedure that Works For Me ™. This uses no additional tools outside of the docker beta for osx download.

First, I’d clean up exited containers and images:
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f “dangling=true” -q)

If that doesn’t clean up enough, you might consider expanding the disk. This is potentially destructive, so make a copy of your cow2 file first:

  1. use qemu to see current disk info, then add 10GB
    export DOCKER_DISK=~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.cow2
    cp $DOCKER_DISK $DOCKER_DISK.backup
    /Applications/Docker.app/Contents/MacOS/qemu-img info ${DOCKER_DISK}
    /Applications/Docker.app/Contents/MacOS/qemu-img resize ${DOCKER_DISK} +10G

  2. Restart docker from the panel or use connect to vm below to connect and reboot it.

  3. Connect to the VM:
    screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
    Press enter if your screen is blank. Login is root/no password

  4. make sure that the new disk space is reflected
    fdisk -l
    make sure that your main linux partition is the second one. We’re going to delete it and re-create it using the remainder of the disk

  5. Now the scary part :wink: Remember that backup? Here we are deleting the partition and re-adding with a larger size. The data should remain intact.

fdisk /dev/vda
key presses, in sequence
p
d
2
n
2
enter
enter
w
reboot

At this point you can reconnect to verify the space is there, and do docker images to ensure everything is still there. If not, restore the backup.