Skip to content

fix: handle pre-existing GID in Dockerfile templates for macOS hosts#613

Open
hlynurstef wants to merge 1 commit into
mattpocock:mainfrom
hlynurstef:fix/dockerfile-macos-gid-conflict
Open

fix: handle pre-existing GID in Dockerfile templates for macOS hosts#613
hlynurstef wants to merge 1 commit into
mattpocock:mainfrom
hlynurstef:fix/dockerfile-macos-gid-conflict

Conversation

@hlynurstef
Copy link
Copy Markdown

@hlynurstef hlynurstef commented May 8, 2026

Summary

  • Adds -o (--non-unique) to groupmod and usermod in all four Dockerfile templates in InitService.ts (claude-code, pi, codex, opencode) and in the repo's own .sandcastle/Dockerfile

Root cause

On macOS, the host GID is typically 20 (staff). The base node:22-bookworm image already has GID 20 assigned to the dialout group. When sandcastle passes AGENT_GID=20 at image build time, groupmod refuses with:

groupmod: GID '20' already exists
exit code: 4

Fix

Adding -o (--non-unique) to both groupmod and usermod allows the node group to share GID 20 with dialout. The collision is harmless — dialout is unused in agent containers.

RUN groupmod -o -g $AGENT_GID node && usermod -o -u $AGENT_UID -g $AGENT_GID -d /home/agent -m -l agent node

Closes #609

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

@hlynurstef is attempting to deploy a commit to the Matt Pocock's projects Team on Vercel.

A member of the Team first needs to authorize it.

On macOS the host GID is typically 20 (staff), which collides with
GID 20 (dialout) already present in node:22-bookworm. groupmod refuses
to reassign a GID that already exists, causing docker build-image to
fail with exit code 4.

Adding -o (non-unique) to both groupmod and usermod lets the node
group share GID 20 with dialout. The collision is harmless since
dialout is unused in agent containers.

Applied to all four Dockerfile templates in InitService.ts (claude-code,
pi, codex, opencode) and to the repo's own .sandcastle/Dockerfile.

Fixes mattpocock#609

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker image fails to build on Mac OS

1 participant