Last active
January 17, 2024 10:34
-
-
Save PvtSec/abe47e748bc78218f4c6be8d09e2ee53 to your computer and use it in GitHub Desktop.
Docker Cleaner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
reset | |
echo y | docker system prune | |
docker stop `docker ps -qa` 2>/dev/null | |
echo -e "\e[32m Stopped all possible containers ✓ \e[0m" | |
docker rm `docker ps -qa` 2>/dev/null | |
echo -e "\e[32m Removed all possible containers ✓ \e[0m" | |
docker rmi -f `docker images -qa ` 2>/dev/null | |
echo -e "\e[32m Removed all possible images ✓ \e[0m" | |
docker volume rm $(docker volume ls -q) 2>/dev/null | |
echo -e "\e[32m Removed all possible volumes ✓ \e[0m" | |
docker network rm `docker network ls -q` 2>/dev/null | |
echo -e "\e[32m Removed all possible networks ✓ \e[0m" | |
service docker restart | |
echo -e "\e[32m Completed Successfully ✓ \e[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment