When I am trying to build the docker image I am getting out of disk space error and after investigating I find the following:
df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 4G 3.8G 0 100% /
How do I fix this out of space error?
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.
Sometimes while running a command inside of a docker container, the container itself will run out of disk space and things can fail (sometimes in strange ways). This is not a guide on how to allocate resources, but a quick cookbook on how to free up disk space inside a container.
docker system prune
https://docs.docker.com/engine/reference/commandline/system_prune/
This will clean up all images, containers, networks, volumes not used. 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.
use command - docker system prune -a
This will cleaned up total Reclaimable Size for Images, Network & Volume..... This will remove all images related reclaimable space which are not associated with any running container.....
Run docker system df
command to view Reclaimable memory
In case there is some Reclaimable memory then if above command does not work in first go then run the same command twice then it should cleaned up.... I have been experiencing this behavior almost on daily basis..... Planning to report this bug to Docker Community but before that want to reproduce this bug with new release to see if this has been fixed or not with latest one....
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