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 <noreply@anthropic.com>
This commit is contained in:
parent
373f393b03
commit
8ed781a6c1
1 changed files with 8 additions and 2 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/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).
|
# By default, KEEPS the PostgreSQL volume (scan history, hosts, users).
|
||||||
# Pass --purge-data to delete the volumes as well — irreversible.
|
# Pass --purge-data to delete the volumes as well — irreversible.
|
||||||
#
|
#
|
||||||
# Usage:
|
# 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
|
# sudo bash uninstall.sh --purge-data # also delete DB + binaries volume
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
@ -39,6 +39,12 @@ else
|
||||||
podman rm -f triton-manageserver triton-manage-db 2>/dev/null || true
|
podman rm -f triton-manageserver triton-manage-db 2>/dev/null || true
|
||||||
fi
|
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
|
if [[ $PURGE -eq 1 ]]; then
|
||||||
info "DESTRUCTIVE: removing manage server volumes..."
|
info "DESTRUCTIVE: removing manage server volumes..."
|
||||||
info " this deletes: scan history, hosts, users, worker binaries"
|
info " this deletes: scan history, hosts, users, worker binaries"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue