forked from mtusi2026/mtusi2026lab4
15 lines
351 B
Bash
Executable File
15 lines
351 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID is required}"
|
|
|
|
for container in $(docker compose --env-file .env ps -q api); do
|
|
hostname=$(docker inspect --format '{{.Config.Hostname}}' "$container")
|
|
if [ "$hostname" = "$TARGET_INSTANCE_ID" ]; then
|
|
docker stop "$container" >/dev/null
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
exit 2
|