TECH BASICS

Docker: How to get your storage back?

arun@controller:~$ sudo docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 15 0 2.674GB 2.674GB (100%)
Containers 0 0 0B 0B
Local Volumes 0 0 0B 0B
Build Cache 0 0 0B 0B
# use -v for more details
docker system df

Big bang approach

$ docker system prune# include -a  to remove all unused images not just dangling ones.# You have an option of putting filter as well.$ docker image prune -a --filter "until=24h"

Controlled approach

$ docker image prune -a
$ docker container prune -a
$ docker network prune -a
$ docker volume prune -a

I - Command line!

$ docker stop $(sudo docker ps -aq) && sudo docker rm $(sudo docker ps -aq)
$ docker rmi $(sudo docker images -q)# dangling 
$ docker rmi $(docker images -f "dangling=true" -q)
$ docker volume rm $(docker volume ls -q -f dangling=true)
$ docker rm $(docker ps -qa --no-trunc --filter "status=exited")
$ cd /var/lib/docker
$ du -sh .

In quest of understanding How Systems Work !

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store