Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the running out of disk space error in Docker?

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?

like image 640
Pritam Banerjee Avatar asked Jul 09 '18 05:07

Pritam Banerjee


People also ask

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.

Can a docker container run out of space?

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.


Video Answer


2 Answers

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.

like image 86
Nick Spicer Avatar answered Oct 03 '22 07:10

Nick Spicer


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....

like image 44
Abhishek Jain Avatar answered Oct 03 '22 07:10

Abhishek Jain