Created
May 20, 2016 19:07
-
-
Save jgornick/d5e20503c37e04a7a428b433dbf4993d to your computer and use it in GitHub Desktop.
Docker: Cleanup (Remove all exited containers and dangling 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 | |
docker rm $(docker ps -q -f status=exited) | |
docker rmi $(docker images -q -f dangling=true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@RSwarnkar, I had a similar issue, my problem got solved by this:
https://stackoverflow.com/questions/53559545/docker-unknown-shorthand-flag-a-in-aq
Basically, if you try
docker rmi $(docker images -q -f dangling=true)
you'll get that error, because
$(docker images -q -f dangling=true)
is a linux command. You'll need to change it to something like this:FOR /f "tokens=*" %i IN ('docker images -q -f dangling=true') DO docker rmi %i
Hope this helps you out.