Skip to content

Instantly share code, notes, and snippets.

@travis-g
Created October 8, 2018 16:40
Show Gist options
  • Save travis-g/a8d6911034472cdcad7d5b2a1c9976ff to your computer and use it in GitHub Desktop.
Save travis-g/a8d6911034472cdcad7d5b2a1c9976ff to your computer and use it in GitHub Desktop.
Docker cleanup script
#!/usr/bin/env sh
# Removes stopped containers and dangling/untagged images.
# 0 0 * * * docker-clean.sh
docker rm $(docker ps -a -q)
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment