Review at  https://gerrit.osmocom.org/7655

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
---
A scripts/docker-cleanup.sh
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/55/7655/1

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

-- 
To view, visit https://gerrit.osmocom.org/7655
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I688b952578507a9cc28fe682221b5c7e3a245519
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to