Created
January 1, 2017 21:26
-
-
Save nknapp/a9a92ed75989cb144740ea5d94a909f5 to your computer and use it in GitHub Desktop.
Clear the complete docker environment
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
#!/bin/bash | |
echo Killing all containers | |
for i in $( docker ps -q ) ; do | |
docker kill $i | |
done | |
echo Removing all containers | |
for i in $( docker ps -aq ) ; do | |
docker rm $i | |
done | |
echo Removing all images | |
for i in $( docker images -q ) ; do | |
docker rmi -f $i | |
done | |
echo Removing all networks | |
for i in $( docker network ls -q ) ; do | |
docker network rm $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this on my laptop to wipe everything from Docker (for when I'm not using any containers)