< Return to Blog

Docker Mac ~ Running Out of Space with "no space left on device”

Having upgraded my local install to the Community Edition (stable), I ran into a scenario where I was receiving a confounding "No space left on device error" error.

Interestingly it seems Docker CE for Mac by default has a max-capacity of 64GB only.

-> % ls -lah ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
-rw-r--r--@ 1 mike  staff    64G 25 May 10:35 /Users/mike/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

-> % docker run --rm ruby:2.3.3 df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay          63G   34G   26G  57% /
tmpfs          1000M     0 1000M   0% /dev
tmpfs          1000M     0 1000M   0% /sys/fs/cgroup
/dev/vda1        63G   34G   26G  57% /etc/hosts
shm              64M     0   64M   0% /dev/shm
tmpfs          1000M     0 1000M   0% /sys/firmware

We can get around this by replacing the original template with a new one, with a size of our choosing. Be warned though - you will loose all local images.

Create a new "template" image with desired size: qemu-img create -f qcow2 ~/data.qcow2 120G where the 120G is my new size. Replace the default docker template /Application/Docker.app/Contents/Resources/moby/data.qcow2 with your brand new ~/data.qcow2 (I've saved the original just in case)

Copy ~/data.qcow2 to ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

Unfortunately this will wipe all your docker data. Also, restart docker. Check disk free: docker run --rm alpine df -h

Reference: https://forums.docker.com/t/no-space-left-on-device-error/10894/17