Search code examples
dockerdocker-machine

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?


Solution

  • docker system prune [-a]
    

    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.

    Other answers address listing system memory usage and increasing the amount of Docker disk space in Docker Desktop:

    The docker system df command can be used to view reclaimable memory --Abishek_Jain

    Open up the docker settings -> Resources -> Advanced and up the amount of Hard Drive space it can use under disk image size. --Nico