Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

docker

macos

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.

like image 801
Greg Avatar asked Jun 05 '16 19:06

Greg


People also ask

How do I free up space on my docker?

A stopped container's writable layers still take up disk space. To clean this up, you can use the docker container prune command. By default, you are prompted to continue. To bypass the prompt, use the -f or --force flag.

How do you free up space if a docker server is running out of space?

We generally try to clean up old images when creating a new one but you could also have this run as a scheduled task on your docker server every day. You need to pass the --volumes flag to prune the volumes as well. Without this only 'unused containers, networks, images (both dangling and unreferenced)' will be pruned.

Where is docker storage on Mac?

On a Mac, the default location for Docker images is ~/Library/Containers/com.


2 Answers

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!

like image 70
unthinkingly Avatar answered Sep 20 '22 18:09

unthinkingly


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

like image 36
Quoting Eddie Avatar answered Sep 19 '22 18:09

Quoting Eddie