Compare commits
No commits in common. "02a7d0f9ba1305367d790e02cd3181ac3d8f8bc4" and "e419466257b8a454bdb05f7f3c26f2190e1e5c2a" have entirely different histories.
02a7d0f9ba
...
e419466257
@ -1,36 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Take an app's containers down + remove them. Two paths run in order:
|
|
||||||
#
|
|
||||||
# 1. `docker compose down -v --remove-orphans` from the app dir. Best
|
|
||||||
# path — clean shutdown, named volumes pruned, orphans swept. Only
|
|
||||||
# runs when the compose file is still on disk.
|
|
||||||
#
|
|
||||||
# 2. Name-based fallback (`dockerRemoveApp`): `docker ps -aqf name=$app`
|
|
||||||
# → stop + rm. Always runs, even when compose down succeeded, to
|
|
||||||
# catch containers compose wouldn't pick up — renamed/relabelled
|
|
||||||
# ones, leftovers from a previously-failed uninstall, and the case
|
|
||||||
# the user flagged: app dir already gone, compose step skipped,
|
|
||||||
# containers were still running.
|
|
||||||
dockerComposeDownRemove()
|
dockerComposeDownRemove()
|
||||||
{
|
{
|
||||||
local app_name="$1"
|
local app_name="$1"
|
||||||
|
|
||||||
if [[ -z "$app_name" ]]; then
|
if [[ "$app_name" == "" ]]; then
|
||||||
isError "No app_name provided, unable to continue..."
|
isError "No app_name provided, unable to continue..."
|
||||||
return 1
|
else
|
||||||
fi
|
if [[ "$OS_TYPE" == "Ubuntu" || "$OS_TYPE" == "Debian" ]]; then
|
||||||
|
if [[ $CFG_DOCKER_INSTALL_TYPE == "rootless" ]]; then
|
||||||
if [[ -d "$containers_dir$app_name" ]]; then
|
if [[ -d "$containers_dir$app_name" ]]; then
|
||||||
isNotice "Shutting down & removing all $app_name container data"
|
local result=$(dockerCommandRunInstallUser "cd $containers_dir$app_name && docker compose down -v --remove-orphans")
|
||||||
if [[ "$CFG_DOCKER_INSTALL_TYPE" == "rootless" ]]; then
|
isNotice "Shutting down & Removing all $app_name container data"
|
||||||
dockerCommandRunInstallUser "cd $containers_dir$app_name && docker compose down -v --remove-orphans" >/dev/null 2>&1
|
dockerRemoveApp $app_name;
|
||||||
else
|
else
|
||||||
(cd "$containers_dir$app_name" && docker compose down -v --remove-orphans) >/dev/null 2>&1
|
isNotice "App directory '$app_name' not found. Skipping container shutdown."
|
||||||
fi
|
fi
|
||||||
|
elif [[ $CFG_DOCKER_INSTALL_TYPE == "rooted" ]]; then
|
||||||
|
if [[ -d "$containers_dir$app_name" ]]; then
|
||||||
|
local result=$(cd $containers_dir$app_name && docker compose down -v --remove-orphans)
|
||||||
|
isNotice "Shutting down & Removing all $app_name container data"
|
||||||
|
dockerRemoveApp $app_name;
|
||||||
else
|
else
|
||||||
isNotice "App directory '$app_name' not found — falling back to name-based container cleanup."
|
isNotice "App directory '$app_name' not found. Skipping container shutdown."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dockerRemoveApp "$app_name"
|
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ dockerUninstallApp()
|
|||||||
echo ""
|
echo ""
|
||||||
dockerRemoveAppImages $stored_app_name;
|
dockerRemoveAppImages $stored_app_name;
|
||||||
else
|
else
|
||||||
echo "---- $menu_number. Keeping Docker images"
|
echo "---- $menu_number. Keeping Docker images (pass --delete-images to remove)"
|
||||||
echo ""
|
echo ""
|
||||||
isNotice "Docker images for '$stored_app_name' left in place. A reinstall will reuse them."
|
isNotice "Docker images for '$stored_app_name' left in place. A reinstall will reuse them."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user