Skip to content

Instantly share code, notes, and snippets.

@selfup
Created April 4, 2018 03:58
Show Gist options
  • Save selfup/66405f1303e65ab87b65e9f1ef1dfa8f to your computer and use it in GitHub Desktop.
Save selfup/66405f1303e65ab87b65e9f1ef1dfa8f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
PS_AQ=$(docker ps -aq)
IMAGES_Q=$(docker images -q)
if [ !$PS_AQ ] || [ !$IMAGES_Q ]
then
echo 'NOTHING TO STOP OR DELETE'
else
echo ' STOPPING ALL CONTAINERS' \
&& docker stop $PS_AQ \
&& echo 'DELETING ALL CONTAINERS' \
&& docker rm $PS_AQ \
&& echo 'DELETING ALL IMAGES' \
&& docker rmi $IMAGES_Q
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment