Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Owner

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