This commit is contained in:
CrazyJasonwell
2026-10-07 11:07:00 +08:00
parent e88e4de0f5
commit 290ff8984f
96 changed files with 213854 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# 等待某个容器完全启动(支持健康检查)
CONTAINER_NAME="xiaoya" # 替换为你的容器名
MAX_RETRIES=30
SLEEP_TIME=5
for i in $(seq 1 $MAX_RETRIES); do
if docker inspect --format '{{.State.Running}}' $CONTAINER_NAME 2>/dev/null | grep -q "true"; then
echo "[INFO] Container $CONTAINER_NAME is running."
sleep 30
exit 0
fi
echo "[WAIT] Container $CONTAINER_NAME not ready ($i/$MAX_RETRIES)..."
sleep $SLEEP_TIME
done
echo "[ERROR] Timeout: Container $CONTAINER_NAME did not start!"
exit 1