Skip to content

Instantly share code, notes, and snippets.

@joelhoelting
Created January 28, 2021 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelhoelting/2ccb4e99089dc8a561014bbf568aebd2 to your computer and use it in GitHub Desktop.
Save joelhoelting/2ccb4e99089dc8a561014bbf568aebd2 to your computer and use it in GitHub Desktop.
Cleanup all docker images, containers, volumes and networks
#!/bin/bash
# Stop all containers
docker stop $(docker ps -aq)
# Remove all images (forced)
docker rmi $(docker images -q) -f
# Remove all containers
docker rm $(docker ps -aq)
# Prune volumes
echo y | docker volume prune
# Prune networks
echo y | docker network prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment