Skip to content

Instantly share code, notes, and snippets.

@micahhausler
Created October 1, 2015 16:25
Show Gist options
  • Save micahhausler/aef24af1ca483282dfea to your computer and use it in GitHub Desktop.
Save micahhausler/aef24af1ca483282dfea to your computer and use it in GitHub Desktop.
docker-clean
docker-clean(){
EXITED=$(docker ps -f status=exited -q)
if [ -n "$EXITED" ]; then
docker rm $EXITED
fi
DANGLING=$(docker images -f dangling=true -q)
if [ -n "$DANGLING" ]; then
docker rmi $DANGLING
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment