ЛР3 - БПИ2303 - Стругов - на 4
This commit is contained in:
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
: "${TARGET_INSTANCE_ID:?test provides instance alias}"
|
||||
# Default Docker hostname is the container's short ID, used as X-Instance-Id.
|
||||
for id in $(docker compose ps -q api); do
|
||||
hostname=$(docker inspect --format '{{.Config.Hostname}}' "$id")
|
||||
if [ "$hostname" = "$TARGET_INSTANCE_ID" ]; then
|
||||
docker stop --time 2 "$id" >/dev/null
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
printf '%s\n' 'No running API container matches TARGET_INSTANCE_ID' >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user