forked from mtusi2026/mtusi2026lab2
перенос основы проекта из 1 лабы
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user