From 8ed781a6c1a0fa52e19c78b975aa9f228651a796 Mon Sep 17 00:00:00 2001 From: amir-climy Date: Tue, 19 May 2026 19:52:16 +0800 Subject: [PATCH] fix(uninstall): remove cached container image on uninstall Without image removal, reinstalling reuses the old cached image even if a newer one is available. Read TRITON_MANAGE_IMAGE from .env (falling back to :latest) and rmi it after stopping containers. Co-Authored-By: Claude Sonnet 4.6 --- manage-server/uninstall.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/manage-server/uninstall.sh b/manage-server/uninstall.sh index a6fcd9a..032639a 100755 --- a/manage-server/uninstall.sh +++ b/manage-server/uninstall.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -# uninstall.sh — stop and remove Manage Server containers. +# uninstall.sh — stop and remove Manage Server containers and image. # # By default, KEEPS the PostgreSQL volume (scan history, hosts, users). # Pass --purge-data to delete the volumes as well — irreversible. # # Usage: -# sudo bash uninstall.sh # stop + remove containers, keep DB +# sudo bash uninstall.sh # stop + remove containers + image, keep DB # sudo bash uninstall.sh --purge-data # also delete DB + binaries volume set -euo pipefail @@ -39,6 +39,12 @@ else podman rm -f triton-manageserver triton-manage-db 2>/dev/null || true fi +# ── remove image ────────────────────────────────────────────────────────── +IMAGE=$(grep -E '^TRITON_MANAGE_IMAGE=' .env 2>/dev/null | cut -d= -f2) +IMAGE=${IMAGE:-ghcr.io/primatekuntech/triton-manage-server:latest} +info "removing image ${IMAGE}..." +podman rmi "$IMAGE" 2>/dev/null || docker rmi "$IMAGE" 2>/dev/null || true + if [[ $PURGE -eq 1 ]]; then info "DESTRUCTIVE: removing manage server volumes..." info " this deletes: scan history, hosts, users, worker binaries"