fix(docker): time out setup image pulls

This commit is contained in:
Vincent Koc
2026-05-26 12:14:09 +02:00
parent da16a966c3
commit dcf0941cd6
2 changed files with 21 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ DOCKER_SOCKET_PATH="${OPENCLAW_DOCKER_SOCKET:-}"
TIMEZONE="${OPENCLAW_TZ:-}"
RAW_SKIP_ONBOARDING="${OPENCLAW_SKIP_ONBOARDING:-}"
SKIP_ONBOARDING=""
DOCKER_PULL_TIMEOUT="${OPENCLAW_DOCKER_SETUP_PULL_TIMEOUT:-600s}"
fail() {
echo "ERROR: $*" >&2
@@ -33,6 +34,15 @@ run_docker_build() {
docker_build_exec "$@"
}
run_docker_pull() {
local image="$1"
if command -v timeout >/dev/null 2>&1; then
timeout "$DOCKER_PULL_TIMEOUT" docker pull "$image"
return
fi
docker pull "$image"
}
is_truthy_value() {
local raw="${1:-}"
raw="$(printf '%s' "$raw" | tr '[:upper:]' '[:lower:]')"
@@ -534,7 +544,7 @@ if [[ "$IMAGE_NAME" == "openclaw:local" ]]; then
"$ROOT_DIR"
else
echo "==> Pulling Docker image: $IMAGE_NAME"
if ! docker pull "$IMAGE_NAME"; then
if ! run_docker_pull "$IMAGE_NAME"; then
echo "ERROR: Failed to pull image $IMAGE_NAME. Please check the image name and your access permissions." >&2
exit 1
fi