Skip to content

Instantly share code, notes, and snippets.

@caktux
caktux / docker_cleanup.sh
Last active December 26, 2015 13:39
Docker cleanup
# ~/.bashrc function
# Use `docker-cleanup --dry-run` to see what would be deleted.
function docker-cleanup {
EXITED=$(docker ps -q -f status=exited)
DANGLING=$(docker images -q -f "dangling=true")
if [ "$1" == "--dry-run" ]; then
echo "==> Would stop containers:"
echo $EXITED
echo "==> And images:"