Fixed the way rm works for better cleanup

pull/1/head
riley 1 year ago
parent 45237f6a73
commit dfeef784bd

@ -78,15 +78,13 @@ case "${ACTION}" in
do_install_detail
;;
"rm")
IMAGE_NAME=$(uci get btcpayserver.@btcpayserver[0].image_name 2>/dev/null)
[ -z "$IMAGE_NAME" ] && IMAGE_NAME="btcpayserver"
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.ID}}')
echo "Stopping and removing containers..."
CONTAINER_IDS=$(docker ps -a | grep 'btcpayserver\|generated_' | awk '{print $1}')
for ID in $CONTAINER_IDS; do
docker stop "$ID"
docker rm "$ID"
done
docker rmi -f "$IMAGE_NAME"
docker rmi -f $(docker images | grep 'btcpayserver' | awk '{print $3}')
rm -r /opt/docker2/compose/btcpayserver 2>/dev/null
rm -rf /opt/docker2/compose/btcpayserver/btcpayserver-docker 2>/dev/null # Removing the btcpayserver-docker directory
;;

Loading…
Cancel
Save