From 1909c2a3aaa36967a4e8edde6d41d1cf0730de8c Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Fri, 20 Feb 2026 09:30:36 -0500 Subject: [PATCH] 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