search cancel

free up space in the / var / lib / docker filesystem


Article ID: 202466


Updated On:


CA API Developer Portal


We are seeing that there is a filesystem in the API Portal 4.x  machine with a large filesystem usage and running out of space. 

/dev/mapper/vg01-lv_docker    68G   54G   11G  84% /var/lib/docker

How do we know what is using the space and how can we free up space


Release : 4x

Component : API PORTAL


Run the following command to see what is using most of the diskspace 

du -hs /var/lib/docker/* | sort -rh | head -10

34G     /var/lib/docker/containers
20G     /var/lib/docker/overlay2
3.4G    /var/lib/docker/volumes
199M    /var/lib/docker/swarm
32M     /var/lib/docker/image
2.0M    /var/lib/docker/network
1.1M    /var/lib/docker/containerd
72K     /var/lib/docker/buildkit
20K     /var/lib/docker/plugins
20K     /var/lib/docker/builder

In this case most of he space is used by containers this could be running and old stopped containers .

As a start run docker container prune

this will clean up all stopped containers 

It will not clear any running containers.