How can I fix Docker/Mac no space left on device error?

I have built a pretty big image (1G) that has a lot of "infrastructure" in it for testing (Mongo, Kafka, etc.)

When trying to start this I get no space left on device errors. How can I fix this?

I've cleaned off stopped images and removed any images I don't absolutely need.


Solution 1:

If you get no space left on device error with Docker, you might be able to solve this easily with system prune.

I use Docker for Mac 17.03.

With docker UP and all your containers RUNNING, execute docker system prune -a

This should give the following dialog:

WARNING! This will remove:
- all stopped containers
- all volumes not used by at least one container
- all networks not used by at least one container
- all images without at least one container associated to them Are you sure you want to continue? [y/N]

Then press y to delete lots of containers, concluding (in my case) with: Total reclaimed space: 23.26 GB.

Now you can go back to work without even rebooting docker!

Solution 2:

You can resize the virtual disk image size in Docker for Mac's Preferences in the Disk tab. This will increase the space without data loss.


In newer versions, the settings can be found in the Resources tab (sub-tab "Advanced"): Option name: Disk image size