Docker for Mac: no space left on the device

October 19, 2016

I came across an issue today, where I could no longer build new images. Apparently i had no space left on device. Here are some of the steps you might take if you come across this issue.

Show virtual image filesize

First check the image filesize. Mine was set at 19G.

$ ls -lah ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

Increase virtual image size

Requires QEMU installed on your system.

If you can afford the space, you can increase the the image size. Here we are adding an extra 10G.

$ qemu-img resize ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 +10G

Delete old stuff

You might want to delete old containers.

$ docker rm $(docker ps -q -f "status=exited")

Or dangling images.

$ docker rmi $(docker images -q -f "dangling=true")

Or dangling volumes.

docker volume rm $(docker volume ls -qf dangling=true)

Delete virtual image

As a final resort, you might want to delete the virtual image and start from scratch. Shutdown Docker for Mac then run this command.

$ rm ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2