Last active
January 12, 2016 07:07
-
-
Save balos1/6bbed6eea7d2625b0fa7 to your computer and use it in GitHub Desktop.
A bash function to remove all docker containers safely.
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
#docker remove all containers | |
function docker-rmall() { | |
printf "The operation will remove all of the following containers: \n" | |
printf '%s \n' $(docker ps -a -q) | |
printf '%s ' 'Continue? [Y/n]: ' | |
read response | |
# if yes then proceed | |
if [[ $response =~ ^[Yy]$ ]] | |
then | |
docker rm $(docker ps -a -q) | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment