summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-04-06 09:31:39 +0200
committerHarald Welte <laforge@gnumonks.org>2018-04-11 06:07:12 +0000
commitacdde1617b7a12eff9bb124935299341474d9b3a (patch)
tree4b49953b97c4f762299efff3793959421b93d4c7 /scripts
parent3e9d6ad7fdd8e3e4a359f5562c399fbb57452002 (diff)
add docker-cleanup.sh script
This script should be executed regularly on all build slaves that have docker in order to discard unused images/layers. It would be a good idea to call "fstrim /" afterwards in order to get more SSD performance. However, the latter requires root access, and hence cannot be called by the 'osmocom-build' user and thus jenkins. Maybe we should install it as a cron job or systemd periodic timer job? Related: OS#3144 Change-Id: I688b952578507a9cc28fe682221b5c7e3a245519
Diffstat (limited to 'scripts')
-rw-r--r--scripts/docker-cleanup.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/docker-cleanup.sh b/scripts/docker-cleanup.sh
new file mode 100644
index 0000000..e7c7d1b
--- /dev/null
+++ b/scripts/docker-cleanup.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# delete all but the latest images
+IMAGES=`docker image ls | grep \^osmocom-build | grep -v latest | awk -F ' ' '{print $1":"$2}'`
+for f in $IMAGES; do
+ docker image rm $f
+done
+
+docker image prune -f