Skip to content

fix: Replace deprecated npm install with native installer in Dockerfile#23853

Open
jaycoolslm wants to merge 1 commit intoanthropics:mainfrom
jaycoolslm:fix/docker-native-install
Open

fix: Replace deprecated npm install with native installer in Dockerfile#23853
jaycoolslm wants to merge 1 commit intoanthropics:mainfrom
jaycoolslm:fix/docker-native-install

Conversation

@jaycoolslm
Copy link
Copy Markdown

Summary

  • Replaced deprecated npm install -g @anthropic-ai/claude-code with native installer (curl -fsSL https://claude.ai/install.sh | bash) in the devcontainer Dockerfile
  • Removed unused CLAUDE_CODE_VERSION build arg and npm-global directory setup
  • Updated PATH to point to ~/.local/bin where the native installer places the binary
  • Added claude.ai to the firewall allowlist in init-firewall.sh
  • Added -exist flag to ipset add to gracefully handle duplicate IPs (claude.ai and api.anthropic.com resolve to the same IP)

Fixes #19985

Test plan

  • Rebuild devcontainer in VS Code and verify claude command is available
  • Verify firewall script completes without errors
  • Verify Claude Code functions correctly inside the container

🤖 Generated with Claude Code

Replace `npm install -g @anthropic-ai/claude-code` with the native
installer (`curl -fsSL https://claude.ai/install.sh | bash`) as npm
installation is now deprecated.

- Remove CLAUDE_CODE_VERSION build arg (no longer needed)
- Remove npm-global directory setup and NPM_CONFIG_PREFIX env var
- Add ~/.local/bin to PATH for native installer binary location
- Add claude.ai to firewall allowlist for installer downloads
- Use ipset -exist flag to handle duplicate IPs gracefully

Fixes anthropics#19985

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@seventhsu
Copy link
Copy Markdown

Just ran into the -exist issue myself as well with marketplace.visualstudio.com resolving to the same IP twice. Worthwhile fix, thanks for adding.

@romanstetsyk
Copy link
Copy Markdown

Any update on this?

@okapies
Copy link
Copy Markdown

okapies commented Mar 25, 2026

I created a .devcontainer example with minimum dependencies for myself. It adopts your fixes about ipset issues. Thanks.

https://github.com/okapies/claude-devcontainer-slim

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.

[BUG] Change installation method from npm to native in Docker file

5 participants