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 complet article from Digital Ocena here