Skip to content

Instantly share code, notes, and snippets.

@joaotorquato
Last active October 16, 2023 14:07
Show Gist options
  • Save joaotorquato/9470ccc5578399a25df216821fedc27a to your computer and use it in GitHub Desktop.
Save joaotorquato/9470ccc5578399a25df216821fedc27a to your computer and use it in GitHub Desktop.
Docker utils

Stop all Docker containers

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

Remove all stopped Docker containers

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

Kill all Docker containers

$ docker kill $(docker ps -q)

Delete all 'untagged/dangling' Docker images

$ docker rmi $(docker images -q -f dangling=true)

Remove all Docker images

$ docker rmi $(docker images -a -q)

Remove all Docker volumes

$ docker volume rm $(docker volume ls -q)

Remove all unused docker images not just dangling ones

$ ddocker system prune -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment