Skip to content

Instantly share code, notes, and snippets.

@balos1
Last active January 12, 2016 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balos1/6bbed6eea7d2625b0fa7 to your computer and use it in GitHub Desktop.
Save balos1/6bbed6eea7d2625b0fa7 to your computer and use it in GitHub Desktop.
A bash function to remove all docker containers safely.
#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