Created
October 1, 2017 01:46
-
-
Save andreiashu/47ec623146ad0fb3023102fbbbc8fe94 to your computer and use it in GitHub Desktop.
WARNING! this will obliterate absolutely all your Docker containers and images. I'm using it on an OSX installation to get rid of the pesky "No space left on device" error (with plenty of free space on my disk). Put it in your ~/.bashrc or ~/.zshrc and run it with `pwndocker`
This file contains hidden or 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
# PWN that sucker! | |
# Warning: completely obliterates Docker: removes all containers, images and volumes | |
# add this function to your ~/.bash_profile or ~/.zshrc (or equivalent) | |
pwndocker() { | |
echo -n "You sure you want to pwn Docker (y/n)? " | |
read answer | |
if echo "$answer" | grep -iq "^y$" ;then | |
[[ -n $(docker ps -qa) ]] && docker kill $(docker ps -qa) | |
[[ -n $(docker ps -qa) ]] && docker rm -v $(docker ps -qa) | |
[[ -n $(docker images -q) ]] && docker rmi -f $(docker images -q) | |
echo "Docker pwned!" | |
else | |
echo No | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might as well use docker stop instead of kill. If you have local volumes there s less risk of potential corruption i guess