Created
November 25, 2016 10:25
-
-
Save KekSfabrik/784670ae34b4ae581de51c9ec73e6bc1 to your computer and use it in GitHub Desktop.
Some Docker cleanup scripts bash/powershell
This file contains hidden or 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
# clean up exited & failed build (status "created") containers | |
docker rm -fv $(docker ps -q --filter status=exited --filter status=created) | |
# PowerShell: | |
ForEach($x in (docker ps -q --filter status=exited --filter status=created)) { docker rm -fv $x } | |
# clean up unused ("dangling") volumes | |
docker volume rm $(docker volume ls -q --filter dangling=true) | |
# PowerShell: | |
ForEach($x in (docker volume ls -q --filter dangling=true)) { docker volume rm $x } | |
# clean up untagged ("dangling") images | |
docker rmi -f $(docker images -q --filter dangling=true | uniq) | |
# PowerShell: | |
ForEach($x in (docker images -q --filter dangling=true) | get-unique) { docker rmi -f $x } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment