From 1909c2a3aaa36967a4e8edde6d41d1cf0730de8c Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Fri, 20 Feb 2026 09:30:36 -0500 Subject: [PATCH 1/2] fix: make Chrome work inside Docker for Claude OAuth browser login Chrome requires --no-sandbox and --disable-dev-shm-usage when running inside a Docker container, otherwise it crashes silently and the OAuth popup never completes. - Add a /usr/local/bin/google-chrome wrapper that injects these flags - Install xdg-utils so xdg-open can resolve browser handlers in VNC - Set BROWSER env var to the wrapper so Claude Code and xdg-open both use it when opening the Claude Max login URL The OAuth callback (to localhost) works fine inside VNC because both the browser and the Claude Code local auth server share the same container network namespace. Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ff93c61..8439d92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,13 +25,19 @@ RUN apt-get update && apt-get install -y \ sudo \ && rm -rf /var/lib/apt/lists/* -# Install Chrome +# Install Chrome and xdg-utils (needed for xdg-open to work in VNC) RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg && \ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \ apt-get update && \ - apt-get install -y google-chrome-stable && \ + apt-get install -y google-chrome-stable xdg-utils && \ rm -rf /var/lib/apt/lists/* +# Chrome wrapper: adds flags required for running inside a Docker container. +# xdg-open (used by Claude Code on Linux) respects $BROWSER, so pointing it +# here ensures the OAuth popup works without manual --no-sandbox invocations. +RUN printf '#!/bin/bash\nexec /usr/bin/google-chrome-stable \\\n --no-sandbox \\\n --disable-dev-shm-usage \\\n --disable-gpu \\\n "$@"\n' > /usr/local/bin/google-chrome && \ + chmod +x /usr/local/bin/google-chrome + # Install Node.js (LTS version for Happy Coder) RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \ apt-get install -y nodejs && \ @@ -69,7 +75,8 @@ WORKDIR /workspace # Configure container to run as user user ENV HOME=/home/user \ - USER=user + USER=user \ + BROWSER=/usr/local/bin/google-chrome # Expose VNC port (baseimage-gui default) EXPOSE 5800 -- 2.52.0 From 32e87254d2b8ea48a9d8bb0679a01bafc8818aa5 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Fri, 20 Feb 2026 09:59:59 -0500 Subject: [PATCH 2/2] fix: run Happy daemon as app user, not root When init-repo.sh starts the happy daemon as root, HOME=/root so Happy and Claude Code can't find credentials stored in /home/user. The mobile app works when the user manually runs happy from a VSCode terminal (as the user user) because the right home dir is in scope. Use sudo -u with -E (preserve environment) so the daemon runs as the correct user while still inheriting the pod's env vars (HAPPY_SERVER_URL, HAPPY_WEBAPP_URL, ANTHROPIC_API_KEY, etc.). Co-Authored-By: Claude Sonnet 4.6 --- scripts/init-repo.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/init-repo.sh b/scripts/init-repo.sh index 6a707a0..45e257b 100644 --- a/scripts/init-repo.sh +++ b/scripts/init-repo.sh @@ -59,11 +59,13 @@ chown -R "$RUN_UID:$RUN_GID" "$WORKSPACE_DIR" mkdir -p "$HOME" chown "$RUN_UID:$RUN_GID" "$HOME" -# Start Happy Coder daemon +# Start Happy Coder daemon as the app user so it can access user credentials +# (running as root means HOME=/root, Claude Code and Happy config would be missing) echo "Starting Happy Coder..." -cd "$WORKSPACE_DIR" -happy daemon start || echo "Happy Coder daemon failed to start, continuing anyway..." +RUN_USER=$(id -nu "$RUN_UID" 2>/dev/null || echo "user") +sudo -u "$RUN_USER" -E sh -c "cd '$WORKSPACE_DIR' && happy daemon start" \ + || echo "Happy Coder daemon failed to start, continuing anyway..." echo "Happy Coder daemon started" -- 2.52.0