Created
July 1, 2016 10:27
-
-
Save TheIndifferent/abd80532877167e3ff1b0ce302403069 to your computer and use it in GitHub Desktop.
Bash script to stop and delete all the docker containers and remove all the 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 | |
echo 'stopping containers...' | |
while [[ -n "$( docker ps -a -q )" ]] | |
do | |
docker stop $(docker ps -a -q) | |
done | |
echo 'deleting containers...' | |
if [[ -n "$( docker ps -a -q )" ]] ; then | |
docker rm $(docker ps -a -q) | |
fi | |
echo 'deleting images...' | |
if [[ -n "$( docker images -q )" ]] ; then | |
docker rmi $(docker images -q) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment