Skip to content

Instantly share code, notes, and snippets.

View benortiz's full-sized avatar

Benjamin Ortiz benortiz

View GitHub Profile
@benortiz
benortiz / docker-cleanup
Created January 11, 2016 23:04
remove unused docker images/containers.
#!/bin/sh
# Cleanup docker files: untagged containers and images.
# place in /usr/bin/
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470