Skip to content

feat: install Claude Code with its native installer in dev containers - #35

Merged
mjun0812 merged 1 commit into
mainfrom
feat/claude-code-native-installer
Sep 7, 2026
Merged

mjun0812 merged 1 commit into
mainfrom
feat/claude-code-native-installer

Conversation

@mjun0812

@mjun0812 mjun0812 commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Overview and Background

The generated dev container now installs Claude Code with Anthropic's native installer during the image build and no longer contains Node.js. Previously Claude Code came from the ghcr.io/anthropics/devcontainer-features/claude-code feature, which installs the npm package and therefore needs Node.js. On Ubuntu 26.04 the feature's own Node.js fallback failed, so #33 had to add the node feature explicitly, reintroducing a runtime that #19 had deliberately removed when Codex switched to its standalone installer.

Related Issues

None. Follows up on #33 and restores the intent of #19.

Implementation Approach

  • The native installer (curl -fsSL https://claude.ai/install.sh | bash) downloads a checksum-verified binary and installs it under $HOME (~/.local/share/claude/versions/<v> with a ~/.local/bin/claude launcher). It is run as the vscode user in the Dockerfile so the files belong to the user that will run it; the transient ~/.claude/downloads directory is removed afterwards.
  • /usr/local/bin/claude is a symlink to the user's launcher so the command works from bash -lc, zsh -lc, and non-login shells without relying on rc files that the common-utils feature rewrites.
  • The claude-code and node features are removed from devcontainer.json. github-cli and common-utils stay.
  • The host ~/.claude bind mount (authentication and config) is unaffected: the binary lives in ~/.local, and the image was verified with an empty ~/.claude mounted over it.

Changes

  • template/.devcontainer/Dockerfile: native Claude Code install as vscode, symlink in /usr/local/bin.
  • template/.devcontainer/devcontainer.json: node and claude-code features removed.
  • README.md, template/README.md: rebuilding the image updates both Claude Code and Codex.

Impact

  • User-facing: claude is available exactly as before. The image no longer ships Node.js or npm; projects that need Node.js for their own work should add the node feature themselves.
  • Updates: Claude Code is fetched at image build time (latest release), the same policy as Codex. The native binary can also self-update inside a running container because it owns ~/.local/share/claude.
  • Build time: the feature step that installed Node.js and the npm package is replaced by a single binary download.

Validation Results

Generated a Python 3.14 project from this branch and built the dev container both with plain Docker and with the Dev Container CLI (features included).

# Plain Dockerfile build; empty ~/.claude mounted to mimic the host bind mount
docker build -f .devcontainer/Dockerfile -t demo-cc-plain .
docker run --rm --user vscode --tmpfs /home/vscode/.claude demo-cc-plain bash -c \
  'claude --version; readlink -f /usr/local/bin/claude; command -v node || echo "node: absent"'
# 2.1.263 (Claude Code)
# /home/vscode/.local/share/claude/versions/2.1.263
# node: absent
docker run --rm demo-cc-plain bash -c 'claude --version'   # 2.1.263 (Claude Code) as root too

# Full build with features
npx -y @devcontainers/cli build --workspace-folder . --image-name demo-cc-full
docker run --rm --user vscode --tmpfs /home/vscode/.claude demo-cc-full zsh -lc \
  'claude --version; gh --version | head -1; command -v node || echo "node: absent"'
# 2.1.263 (Claude Code) / gh version 2.100.0 / node: absent
docker run --rm --user vscode demo-cc-full bash -lc 'claude --version; codex --version; uv --version'
# 2.1.263 (Claude Code) / codex-cli 0.153.4 / uv 0.12.10

- Run the official install script as the vscode user during the image
  build and expose the launcher through /usr/local/bin so it works from
  every shell without rc file changes
- Drop the claude-code and node dev container features; the native
  binary needs no Node.js, matching how Codex is already installed
- Document that rebuilding the image updates both Claude Code and Codex
@mjun0812 mjun0812 added the enhancement New feature or request label Sep 7, 2026
@mjun0812 mjun0812 self-assigned this Sep 7, 2026
@mjun0812
mjun0812 merged commit ba73416 into main Sep 7, 2026
7 checks passed
@mjun0812
mjun0812 deleted the feat/claude-code-native-installer branch September 7, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant