Docker trick: How to stop and remove all current containers

Penetration Testing Wiki

Docker trick: How to stop and remove all current containers

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

For some system maintenance:

$ docker system df
$ docker container prune # Removes all stopped containers
$ docker image prune
$ docker volume prune

Or to delete everything that is not being used:

$ docker system prune

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.