Hard way to clean docker

How to save disk space making hard clining

Nicola Landro
1 min readMar 4, 2023

Docker is very usefull tool byt sometimes you use a large amount of disk memory during time, so I have an hard way to clean it.

Clening guide

Tipically once a month I made my hard cleaning with following commands:

docker stop $(docker ps -q)
docker rm $(docker ps -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls -q)
docker network prune

That commands will remove each part of docker so when you re-run something you will download it.

Conclusions

I make a lot of experiments so into a month I have to many unused docekr images so this hard cleaning work fine for me because the most of images that I have are realy useless, in general if you are more clean or use almost the same containers the disk that you have free is the best that you can have.

--

--

Nicola Landro

Linux user and Open Source fun. Deep learning PhD. , Full stack web developer, Mobile developer, cloud engineer and Musitian.