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.
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.
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.
On a Mac, the default location for Docker images is ~/Library/Containers/com.
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!
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"):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With