Run claude-agent as non-root user — Claude Code refuses bypassPermissions as root
build-agent / build-and-push (push) Successful in 16s

This commit is contained in:
2026-08-23 11:25:28 +00:00
parent 6da5c8cc44
commit 8dfdcb80e8
+6
View File
@@ -8,11 +8,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g @anthropic-ai/claude-code
RUN useradd --create-home --shell /bin/bash agent && mkdir -p /workspace
WORKDIR /app
COPY package*.json ./
RUN npm install --omit=dev
COPY src ./src
RUN chown -R agent:agent /app /workspace
# Claude Code refuses to run with bypassPermissions as root — headless/unattended
# operation needs a non-root user.
USER agent
RUN git config --global user.email "claude-agent@apps.williamturner.eu" \
&& git config --global user.name "claude-agent" \