From 208433c4363ca1d7cb5e6e66de0297c431bc29c8 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 21 Mar 2026 22:28:24 +1300 Subject: [PATCH] feat: Add _remove_volume helper to agent-remote common.sh --- source/agent-remote/common.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/agent-remote/common.sh b/source/agent-remote/common.sh index f770d22..e003774 100755 --- a/source/agent-remote/common.sh +++ b/source/agent-remote/common.sh @@ -22,6 +22,7 @@ # _remove_container : Stops (if needed) and removes a container. # _get_container_logs : Prints the logs for a container. # _check_required_env_vars "VAR1" ... : Checks if listed environment variables are set; calls _die() if any are missing. +# _remove_volume : Removes a Docker volume if it exists. # _root_remove_tree : Removes a path using a root Docker container (for permissions). # ---------------------------------------------------------------------------------------------------------- @@ -162,6 +163,14 @@ _check_required_env_vars() { done } +# Removes a Docker volume if it exists. +_remove_volume() { + [ -n "${1:-}" ] || { echo "_remove_volume: Volume name is empty" >&2; return 1; } + if docker volume inspect "$1" &>/dev/null; then + docker volume rm "$1" + fi +} + # Removes a path using a root Docker container (for permissions). _root_remove_tree() { local to_remove="$1"