From 235d4f8913907f78f50d1d960ab132d6de71993d Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 2 Sep 2022 18:08:51 +0200 Subject: [PATCH] fix: [nextcloud] make ``upgrade`` clean possibly unused old images on its way Signed-off-by: Valentin Lab --- nextcloud/actions/upgrade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nextcloud/actions/upgrade b/nextcloud/actions/upgrade index 8d8902d..84133e9 100755 --- a/nextcloud/actions/upgrade +++ b/nextcloud/actions/upgrade @@ -152,6 +152,9 @@ if [ -n "$containers" ]; then err "Failed to stop container '$container'." exit 1 } + docker rm "$container" > /dev/null || { + err "Couldn't delete container '$container'." + } container_stopped+=("$container") done fi @@ -180,6 +183,7 @@ for image_version in "${upgrade_path[@]}"; do err "Unexpected step where config version ${WHITE}$current_config_version${NORMAL} is more than one major version less than image version ${WHITE}$image_version${NORMAL}" exit 1 fi + docker rmi "docker.0k.io/nextcloud:${current_config_version}-myc" >/dev/null 2>&1 || true if [ "$current_code_version" == "$image_version" ]; then ## Code already setup, we need to call ``occ upgrade`` by our selves info "Upgrading ${WHITE}$current_config_version${NORMAL} => ${WHITE}$image_version${NORMAL} (db)"