Created
March 3, 2020 01:31
-
-
Save thomsh/a958d68567fd5f3f9d4365a543c69807 to your computer and use it in GitHub Desktop.
Clean & freeup ressources when using docker manualy.
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
#!/usr/bin/env bash | |
set -euxo pipefail | |
echo "[*] Clean up exited or created but unused containers" | |
docker ps -a -q -f status=exited |xargs -r -- docker rm -v | |
docker ps -a -q -f status=created |xargs -r -- docker rm -v | |
echo "[*] Remove dangling images" | |
docker images -f dangling=true -q |xargs -r -- docker rmi | |
echo "[*] Purge system ressources & volumes" | |
docker volume prune -f | |
docker system prune -f | |
echo "[*] Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment