fix: agents Dockerfile fails to build — cli.anthropic.com DNS does not resolve (#637)

- Remove curl|sh Claude CLI download from Dockerfile (no internet needed)
- Mount host Claude CLI binary into container via docker-compose volume
- generate_compose() resolves host claude path at init time
- entrypoint.sh fails fast with clear error if claude CLI is missing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-24 22:26:26 +00:00
parent d7d2d1e12f
commit 7844b29a37
3 changed files with 26 additions and 4 deletions

View file

@ -4,10 +4,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
bash curl git jq tmux cron python3 openssh-client ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Claude CLI — install and verify
RUN curl -fsSL https://cli.anthropic.com/install.sh | sh \
&& cp "$(find /root -name claude -type f 2>/dev/null | head -1)" /usr/local/bin/claude \
&& claude --version
# Claude CLI is mounted from the host via docker-compose volume.
# No internet access to cli.anthropic.com required at build time.
# Non-root user
RUN useradd -m -u 1000 -s /bin/bash agent

View file

@ -44,6 +44,17 @@ with open(sys.argv[1], 'rb') as f:
}
log "Agent container starting"
# Verify Claude CLI is available (expected via volume mount from host).
if ! command -v claude &>/dev/null; then
log "FATAL: claude CLI not found in PATH."
log "Mount the host binary into the container, e.g.:"
log " volumes:"
log " - /usr/local/bin/claude:/usr/local/bin/claude:ro"
exit 1
fi
log "Claude CLI: $(claude --version 2>&1 || true)"
install_project_crons
# Run cron in the foreground. Cron jobs execute as the agent user.