Docker Community Forums

Share and learn in the Docker community.

Best practices to handle docker overlays subdirectories

I was facing low disk space on my vm and after further investigation found that docker var/lib/docker/overlay2 consumed all available space.

Approx 40 GB space utilized after running a image multiple time. Basically on vm restart docker container automatically runs to makes containerized application available at all points of time.

Went through dozen of such issues logged on internet but haven’t found good way to handle that.

Can anyone have the better understanding of handling such problems and steps to follow ?

I appreciate your help !

Use the command docker system prune -a to reclaim free space for unused items:
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all images without at least one container associated to them
- all build cache

If this doest’t help: you might think about assigning more space to the blockdevice…

Thanks Metin !
I already tried but didn’t works for me.

Can you tell me how much space does required for running 4 containers using 2 images ?

I’m using teamcity server and agent images from Jetbrains.

This pretty much depends on how big your images are and how many data you write inside your container (instead into a volume). Every guess could be wrong…

Use docker system df to see the space occupied by docker.

1 Like