Introduction

this is part 20 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.


Cleaning

ps-a

Let's see how many stopped containers we have by using

docker ps -a

We have a lot!

what about images?

images

docker image ls

we see a lot of basically those none are failed building images and they are not being used by anything , they called dangling images.

to see how much docker using space we run

system-df

docker system df

we can see it's taking 6.1GB lot of space

let's clean all images that are not used by containers and dangling , we run

prune

docker system prune

some useful tags here : -f used to force , so we don't get a prompt to delete (good for automation tools) -a used to delete every things including used images.

I am going to use prune-f

docker system prune -f

we see it delete lot of things , cool!

image-ls

docker ps -a
docker image ls

as we see we have no containers anymore all stopped and all our images gone!

if you need only to stop containers .

docker-stop

docker container stop $(docker container ls -a -q)

This post is also available on DEV.