Cleaning the docker cache (mess) in my Jenkins server

Every 4-5 weeks i need to do service to my Jenkins because we haven’t found the way that Docker stop accumulating so much containers, images and volumes, so i give you the specific commands that i use: (For bash)

clean prune resources (Volumes, images and containers):

docker system prune -a

Removing all Images

docker rmi $(docker images -a -q)

Stop and Remove all containers

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

Remove unused Volumes:

docker volume prune


You can read the complete article from Digital Ocena here


Share This:

Get The Best Of All Hands Delivered To Your Inbox

Subscribe to our newsletter and stay updated.