Sign inSign up

weaponsforge/claude-cli

By weaponsforge

โ€ขUpdated 8 days ago

Claude Code CLI image with directories and .env config setup

Image
Developer tools
0

668

weaponsforge/claude-cli repository overview

โ claude-cli

Light-weight Docker wrapper for Claude Code CLI, installing it in an isolated container to avoid direct installation in a host machine. Installed with Node.js 24.11.0, Python3 and pip.

INFO: This Docker setup is similar to weaponsforge/gemini-cliโ , but for the Claude Code CLI.

Pre-installed Playwright and Chromium: to use an image with pre-installed Playwright and Chromium, build with https://github.com/weaponsforge/claude-cli/blob/main/Dockerfile.semiโ 

This image is only for local development purposes.

GitHub Repository
https://github.com/weaponsforge/claude-cliโ 

โ ๐Ÿ“‹ Requirements

โ Anthropic account

Choose between the two (options):

1. Anthropic account with Claude subscription (Pro, Max, Team, or Enterprise)

  • No need to have $5 API credits when using the "Claude account with subscription" option on CLI login

2. Anthropic account with at least $5 API credits

  • Add funds under Anthropic Consoleโ  โŸถ Credits โŸถ Add funds
  • Only required when using the ANTHROPIC_API_KEY key and the "Anthropic Console account ยท API usage billing" option with Claude Code CLI login
  • Ensure the ANTHROPIC_API_KEY is linked with a Workspace under your account.
  • Generate an Anthropic key at the Anthropic Console


โ ๐Ÿš€ Usage

โ 1. Pull the "latest" development image
docker pull weaponsforge/claude-cli
โ 2. (Optional) Use an Anthropic API Key
  • Create a .env file from the .env.example file.
  • Replace the value of the ANTHROPIC_API_KEY with your own Anthropic API key.

๐Ÿ’กINFO: Use this option if you don't have a Claude subscription,
but have at least $5 credits for Claude API.

โ 3. Run the Claude Code CLI

Prepare the project code folder that which may optionally require a .env file.

โ€ผ๏ธ IMPORTANT:
The project folder must be the root of your Node.js application (typically the directory containing package.json and /node_modules), not a parent directory containing the app.

For example if your project is a Node.js/React app under the "my-app" folder:

โ”œโ”€ my-app
โ”‚   โ”œโ”€ .env             # optional
โ”‚   โ”œโ”€ package.json
โ”‚   โ”œโ”€ package-lock.json
โ”‚   โ”œโ”€ node_modules
โ”‚   โ”œโ”€ public
โ”‚   โ”œโ”€ app
โ”‚   โ”œโ”€โ”€โ”€ favicon.ico
โ”‚   โ”œโ”€โ”€โ”€ globals.css
โ”‚   โ”œโ”€โ”€โ”€ layout.tsx
โ”‚   โ”œโ”€โ”€โ”€ page.tsx
โ”‚   โ”œโ”€ components 
โ”‚   โ”œโ”€โ”€โ”€ ...

Mount it in the container using:

Bash (with .env file)

docker run -it --rm \
  --name weaponsforge-claude-cli \
  --security-opt no-new-privileges:true \
  --cap-drop ALL \
  -v /path/to/my-app:/opt/app \
  -v /opt/app/node_modules \
  -v /opt/app/.next \
  -v /opt/app/node_modules/.vite \
  -v /opt/app/node_modules/.tmp \
  --env-file /path/to/my-app/.env \
  weaponsforge/claude-cli:latest \
  claude

Bash (no .env file)

docker run -it --rm \
  --name weaponsforge-claude-cli \
  --security-opt no-new-privileges:true \
  --cap-drop ALL \
  -v /path/to/my-app:/opt/app \
  -v /opt/app/node_modules \
  -v /opt/app/.next \
  -v /opt/app/node_modules/.vite \
  -v /opt/app/node_modules/.tmp \
  weaponsforge/claude-cli:latest \
  claude

๐Ÿ’ก TIPS:

  • Include the ANTHROPIC_API_KEY in the project's .env file if you are using the Anthropic API Key for Claude Code authentication instead of browser sign-in
  • IMPORTANT: take note to mount "node_modules" as an anonymous volume "-v /opt/app/node_modules" so that container npm installs don't land in the host file system
  • Refer to the project's GitHub READMEโ  file for detailed usage information
โ 4. Login to the Claude CLI
  • Select the "Claude account with subscription ยท Pro, Max, Team, or Enterprise" option on CLI login if you have a Claude subscription
  • Select the "Anthropic Console account ยท API usage billing" option on CLI login if you don't have a Claude subscription but have at least $5 API credits and an ANTHROPIC_API_KEY in the .env file
โ 5. Confirm that Claude Code can read the mounted project folder

Ask Claude:

analyze and explain to me this repository.

Claude should output details of the project folder mounted in step #3 (eg., "my-app")

Tag summary

Content type

Image

Digest

sha256:e5d84a68aโ€ฆ

Size

491.9 MB

Last updated

8 days ago

docker pull weaponsforge/claude-cli