Skip to content

Commit 0e1f9cf

Browse files
committed
claude-docker: fix VS Code CLI URL and non-interactive docker run
The cli-linux-x64 identifier on code.visualstudio.com/sha/download returns 404; use update.code.visualstudio.com/latest/cli-linux-x64/stable, which delivers the glibc-linked binary that matches the Ubuntu base. Also stop forcing -it unconditionally, which broke CI-style invocations with "cannot attach stdin to a TTY-enabled container". Allocate a TTY only when both stdin and stdout are terminals; otherwise pass -i so piped input still reaches the container. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
1 parent 72a579a commit 0e1f9cf

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

claude.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,26 @@ CONTAINER_HOME="/home/claude-user"
8686

8787
# --- Assemble docker run arguments ---
8888
DOCKER_RUN_ARGS=(
89-
--rm -it
89+
--rm
9090
--name "${CONTAINER_NAME}"
9191
-v "${SCRIPT_DIR}:/workspace"
9292
-e "HOST_UID=$(id -u)"
9393
-e "HOST_GID=$(id -g)"
9494
-w /workspace
9595
)
9696

97+
# TTY/stdin handling for interactive, CI, and piped-input cases:
98+
# * terminal in + terminal out → -it (normal interactive use)
99+
# * anything else → -i (pass stdin through; no TTY)
100+
# Forcing -it unconditionally breaks non-interactive use
101+
# ("cannot attach stdin to a TTY-enabled container"), and dropping -i
102+
# would silently discard piped input like `cat prompt.txt | claude.sh ...`.
103+
if [[ -t 0 && -t 1 ]]; then
104+
DOCKER_RUN_ARGS+=(-it)
105+
else
106+
DOCKER_RUN_ARGS+=(-i)
107+
fi
108+
97109
# Pass through optional environment variables
98110
for var in ANTHROPIC_API_KEY ANTHROPIC_MODEL CLAUDE_CODE_MAX_TURNS \
99111
CLAUDE_CODE_USE_BEDROCK \

docker/Dockerfile.claude

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ RUN apt-get update \
4040
ripgrep \
4141
&& rm -rf /var/lib/apt/lists/*
4242

43-
# VS Code CLI (code-tunnel for remote editing)
44-
RUN curl -fsSL "https://code.visualstudio.com/sha/download?build=stable&os=cli-linux-x64" \
43+
# VS Code CLI (code-tunnel for remote editing).
44+
# Use the glibc build to match the Ubuntu base image. (The cli-alpine-x64
45+
# variant on code.visualstudio.com is statically linked and also works,
46+
# but the linux-x64 build from update.code.visualstudio.com is the
47+
# canonical match for glibc distros.)
48+
RUN curl -fsSL "https://update.code.visualstudio.com/latest/cli-linux-x64/stable" \
4549
-o /tmp/vscode-cli.tar.gz \
4650
&& tar -xzf /tmp/vscode-cli.tar.gz -C /usr/local/bin \
4751
&& rm /tmp/vscode-cli.tar.gz

0 commit comments

Comments
 (0)