Skip to content

Instantly share code, notes, and snippets.

@vpetersson
Created June 23, 2015 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpetersson/e97862472ab669d88ed9 to your computer and use it in GitHub Desktop.
Save vpetersson/e97862472ab669d88ed9 to your computer and use it in GitHub Desktop.
Docker cleanup script.
#!/bin/bash
CONTAINERS="$(docker ps -a -q)"
if [ -n "$CONTAINERS" ]; then
docker rm "$CONTAINERS"
fi
for i in $(docker images --filter 'dangling=true' -q); do
docker rmi $i;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment