Last active
May 20, 2018 13:42
-
-
Save henvo/99ce2ea25818ff039515222b7e18c3e1 to your computer and use it in GitHub Desktop.
This script stops and removes all docker containers and their images
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 | |
# WARNING: This script will remove all containers and images | |
echo -n "Do you want to factory-reset your docker (Y/n)? " | |
read answer | |
if [ "$answer" != "${answer#[Yy]}" ] ;then | |
# Stop all containers | |
docker stop $(docker ps -q) | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi $(docker images -q) | |
else | |
echo Ok, bye | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this script via:
bash <(curl -sL https://bit.ly/2wYmHyf)