Created
April 11, 2018 13:27
-
-
Save jacek-marchwicki/447596428acacd752ea76d4076d50650 to your computer and use it in GitHub Desktop.
Clean old images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
echo "WARNING" | |
echo "All docker files that are currenlty not runned will be removed!" | |
echo "Press enter to continue, or ctrl+c" | |
read | |
echo "Removing stopped images" | |
docker ps -a -q -f status=exited | xargs --no-run-if-empty docker rm || echo "Oooopps..." | |
echo "Removing not used images" | |
docker images -q | xargs --no-run-if-empty docker rmi || echo "Oooopps..." | |
echo "Removing orphaned volumes" | |
docker volume ls -qf dangling=true | xargs -r docker volume rm || echo "Oooopps..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment