Skip to content

Instantly share code, notes, and snippets.

@mariogarcia-ar
Created April 13, 2024 17:11
Show Gist options
  • Save mariogarcia-ar/f964d107264bad3408d6fafd8aa9e93f to your computer and use it in GitHub Desktop.
Save mariogarcia-ar/f964d107264bad3408d6fafd8aa9e93f to your computer and use it in GitHub Desktop.
#!/bin/bash
# Stop all running containers
echo "Stopping all running containers..."
docker stop $(docker ps -a -q)
# Remove all containers
echo "Removing all containers..."
docker rm $(docker ps -a -q)
# Remove all images
echo "Removing all images..."
docker rmi $(docker images -a -q)
# Remove all volumes
echo "Removing all volumes..."
docker volume rm $(docker volume ls -q)
# Remove all networks
echo "Removing all networks..."
docker network rm $(docker network ls -q)
# System prune to remove any unused data
echo "Performing system prune..."
docker system prune -af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment