[MERGED] osmo-ci[master]: add docker-cleanup.sh script

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Apr 11 06:07:38 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: add docker-cleanup.sh script
......................................................................


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(-)

Approvals:
  lynxis lazus: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved; Verified



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: merged
Gerrit-Change-Id: I688b952578507a9cc28fe682221b5c7e3a245519
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>



More information about the gerrit-log mailing list