Created
May 17, 2018 21:48
-
-
Save mlgill/aecdef625cea79445ae364e3e93a8168 to your computer and use it in GitHub Desktop.
Docker Cleanup
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
# Remove all exited containers | |
docker rm `docker ps -a -q --filter status=exited` 2>/dev/null | |
# Remove any orphaned containers related to "INSERT_CONTAINER_NAME_HERE" | |
docker rm `docker ps -a -q --filter ancestor=INSERT_CONTAINER_NAME_HERE` 2>/dev/null | |
# Remove any orphaned images from aborted/old builds | |
docker rmi `docker images -q -f "dangling=true"` 2>/dev/null | |
# Clean up whatever disk-hogging stuff Docker leaves lying aroung | |
docker system prune --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment