Last active
March 31, 2017 01:18
-
-
Save drstearns/fdc2ca29ee82c1810d85387e17dcc1c6 to your computer and use it in GitHub Desktop.
Script to clean up exited docker containers and dangling docker 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 | |
cids=$(docker ps -f "status=exited" -aq) | |
if [ "$cids" ]; then | |
docker rm $cids | |
fi | |
iids=$(docker images -q --filter "dangling=true") | |
if [ "$iids" ]; then | |
docker rmi $iids | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment