forked from mtusi2026/mtusi2026lab4
15 lines
446 B
Bash
15 lines
446 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
TARGET="${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID not set}"
|
|
|
|
for container in $(docker ps --filter "name=mtusi2026lab4-api-" --format "{{.Names}}"); do
|
|
if docker logs "$container" 2>&1 | grep -q "INSTANCE_ID=$TARGET"; then
|
|
echo "[stop-one] stopping $container (instance=$TARGET)"
|
|
docker stop "$container"
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
echo "[stop-one] no container found for INSTANCE_ID=$TARGET" >&2
|
|
exit 1 |