Debugging Docker disk usage issues

The first thing to do will be checking the Docker memory usage statistics:

docker system df

which prints out the current memory usage for containers, images, volumes, etc. and how much of it could be reclaimed.

To reclaim it you can run
docker system prune
which in essence it an alias to


    docker container prune
    docker image prune
    docker network prune
    docker volume prune

Be aware that default behavior is to delete dangling data. If you want to delete dangling and unused use -a argument (with caution, in prod it maybe not advisable to do so).

To find out mounted containers you can use findmnt command. It will show you where merged folder is located.

Another technic which I found useful is to find out a docker process which is an owner of overlay2 folder.

#since you dont know the purpose of a folder under /overlay2 folder you should check every graph driver
docker inspect -f $'{{.Name}}\t{{.GraphDriver.Data.MergedDir}}' $(docker ps -aq)
or
docker inspect -f $'{{.Name}}\t{{.GraphDriver.Data.LowerDir}}' $(docker ps -aq)

Get the latest posts delivered right to your inbox.