Skip to content

Instantly share code, notes, and snippets.

@makuk66
Created November 18, 2015 08:45
Show Gist options
  • Save makuk66/b4409a1f182c43859b50 to your computer and use it in GitHub Desktop.
Save makuk66/b4409a1f182c43859b50 to your computer and use it in GitHub Desktop.
#! /bin/bash
set -eo pipefail
for container in $(docker ps --no-trunc --all --quiet --filter status=exited); do
docker rm $container
done
for image in $(docker images -q -f "dangling=true"); do
docker rmi $image
done
for vol in $(docker volume ls --filter dangling=true | grep '^local' | awk '{print $2}'); do
docker volume rm $vol
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment