From e7d0fbd37209618676dd3fe7a8ca91b29bfaecf2 Mon Sep 17 00:00:00 2001 From: earlgreyrey Date: Sat, 2 Aug 2025 07:59:44 +0000 Subject: [PATCH] Optimized removal process with loop Change-Id: I5293bf42c6f20828fc78e90233ac280974ee2a88 Signed-off-by: earlgreyrey --- bin/docker_images_delete_local.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/bin/docker_images_delete_local.sh b/bin/docker_images_delete_local.sh index 5c6b4fa..7407787 100755 --- a/bin/docker_images_delete_local.sh +++ b/bin/docker_images_delete_local.sh @@ -15,10 +15,20 @@ # limitations under the License. # # ================================================================================== -sudo nerdctl --namespace k8s.io rmi tm:latest -sudo nerdctl --namespace k8s.io rmi data-extraction:latest -sudo nerdctl --namespace k8s.io rmi kfadapter:latest -sudo nerdctl --namespace k8s.io rmi aiml-dashboard:latest -sudo nerdctl --namespace k8s.io rmi aiml-notebook:latest -sudo nerdctl --namespace k8s.io rmi kserve-adapter:1.0.1 -sudo nerdctl --namespace k8s.io rmi modelmgmtservice:latest +images=( + "tm:latest" + "data-extraction:latest" + "kfadapter:latest" + "aiml-dashboard:latest" + "aiml-notebook:latest" + "kserve-adapter:1.0.1" + "modelmgmtservice:latest" +) + +for image in "${images[@]}"; do + if sudo nerdctl --namespace k8s.io rmi "$image"; then + echo "[INFO] Successfully removed image: $image" + else + echo "[ERROR] Failed to remove image: $image" >&2 + fi +done -- 2.16.6