From 14f3d3483849c58db7a292a08d7ba7dd7c6c0334 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 4 Dec 2024 16:29:14 +0100 Subject: [PATCH] new: [compose-core] cast error when more than one container is found for ``get_healthy_container_ip_for_service`` --- bin/compose-core | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/compose-core b/bin/compose-core index d9ab164..101c737 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -4289,6 +4289,12 @@ get_healthy_container_ip_for_service () { return 1 fi + if [ "$(echo "$containers" | wc -l)" -gt 1 ]; then + err "More than 1 container running for service $DARKYELLOW$SERVICE_NAME$NORMAL." + echo " Please contact administrator to fix this issue." >&2 + return 1 + fi + ## XXXvlab: taking first container is probably not a good idea container="$(echo "$containers" | head -n 1)"