Created
July 12, 2017 21:15
-
-
Save chicagobuss/474bc5b1d435487f1085cbdb9f3b1dd3 to your computer and use it in GitHub Desktop.
Docker cleanup script
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
| #!/bin/bash | |
| echo "Removing exited containers" | |
| for i in $(sudo docker ps -a | grep Exit | awk '{print $1}') | |
| do | |
| sudo docker rm ${i} | |
| done | |
| echo "Removing unused images" | |
| for i in $(sudo docker images | grep -v REPOS | awk '{print $3}') | |
| do | |
| sudo docker rmi ${i} | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment