Skip to content

Instantly share code, notes, and snippets.

@nknapp
Created January 1, 2017 21:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nknapp/a9a92ed75989cb144740ea5d94a909f5 to your computer and use it in GitHub Desktop.
Save nknapp/a9a92ed75989cb144740ea5d94a909f5 to your computer and use it in GitHub Desktop.
Clear the complete docker environment
#!/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
@nknapp
Copy link
Author

nknapp commented Jan 1, 2017

I use this on my laptop to wipe everything from Docker (for when I'm not using any containers)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment