#!/bin/sh set -eu cd "$(dirname "$0")/.." : "${TARGET_INSTANCE_ID:?Missing target API instance}" for id in $(docker compose ps -q api); do if [ "$(docker inspect --format '{{.Config.Hostname}}' "$id")" = "$TARGET_INSTANCE_ID" ]; then docker stop --time 8 "$id" >/dev/null exit 0 fi done echo 'The target is not a running API replica of this Compose project' >&2 exit 1