Skip to content

Instantly share code, notes, and snippets.

@greyltc
Last active October 23, 2016 17:59
Show Gist options
  • Save greyltc/ea2b0fbc5e815af55768 to your computer and use it in GitHub Desktop.
Save greyltc/ea2b0fbc5e815af55768 to your computer and use it in GitHub Desktop.
cleans up docker images/containers
#!/usr/bin/env bash
# docker cleanup (if you're not careful, docker loves to eat disk space)
# bash <(curl -L https://gist.github.com/greyltc/ea2b0fbc5e815af55768/raw)
echo "Cleaning up unneeded docker images."
docker stop $(docker ps -a -q) || echo "No container to stop"
docker rm $(docker ps -a -q) || echo "No container to remove"
docker rmi $(docker images -f "dangling=true" -q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment