#!/usr/bin/env bash set -euo pipefail container="${1:-mtusi-messenger-lab2}" for ((attempt = 0; attempt < 60; attempt++)); do running="$(docker inspect --format '{{.State.Running}}' "$container")" health="$(docker inspect --format '{{.State.Health.Status}}' "$container")" if [[ "$running" != true || "$health" == unhealthy ]]; then echo "Контейнер $container не готов. Посмотри: docker logs $container" >&2 exit 1 fi if [[ "$health" == healthy ]]; then echo "$container: healthy" exit 0 fi sleep 1 done echo "Контейнер $container не стал готов за 60 секунд" >&2 exit 1