Skip to content

Instantly share code, notes, and snippets.

@bombsimon
Created August 12, 2018 15:28
Show Gist options
  • Save bombsimon/ae72cde8651052bfce7e7a2b119475fd to your computer and use it in GitHub Desktop.
Save bombsimon/ae72cde8651052bfce7e7a2b119475fd to your computer and use it in GitHub Desktop.
Cleanup everything docker is leaving behind
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
if [[ -n $(docker ps -a -q -f status=exited) ]]; then
docker rm $(docker ps -a -q -f status=exited)
fi
if [[ -n $(docker images --filter dangling=true -q) ]]; then
docker rmi $(docker images --filter dangling=true -q)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment