From 81cca1c2e133138ae558cc2a6920b295421c612d Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Tue, 23 May 2023 20:05:37 +1000 Subject: [PATCH 1/2] cleanup-docker.sh: initial commit Script to cleanup docker runner servers --- scripts/cleanup_docker.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 scripts/cleanup_docker.sh diff --git a/scripts/cleanup_docker.sh b/scripts/cleanup_docker.sh new file mode 100644 index 0000000..2e6c327 --- /dev/null +++ b/scripts/cleanup_docker.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# abort at error +set -e + +# If you think docker images might be corrupt, +# or if the runner server needs to cleaned up. + +# house keeping +docker container prune -f +docker image prune -f + +# report +docker image ls +docker container ls + +# cleanup +docker image ls -q | xargs docker image rm + +# final report +docker image ls +docker container ls + +#Should have no images except the running docker GHA container + +exit 0 From e3cdb5b3aab5526153ed08c5b23685cdf9806669 Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Sun, 19 Nov 2023 23:27:17 +1100 Subject: [PATCH 2/2] Update cleanup_docker.sh --- scripts/cleanup_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cleanup_docker.sh b/scripts/cleanup_docker.sh index 2e6c327..c359de2 100644 --- a/scripts/cleanup_docker.sh +++ b/scripts/cleanup_docker.sh @@ -15,7 +15,7 @@ docker image ls docker container ls # cleanup -docker image ls -q | xargs docker image rm +docker image ls -q | xargs docker image rm -f # final report docker image ls