claude-container

作者 nezhar已验证

Container workflow for Claude Code. Complete isolation from host system while maintaining persistent credentials and workspace access.

163
Stars
19
Forks
Shell
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/nezhar/claude-container

快速入门

使用 claude-container 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Claude Container

A Docker container with Claude Code pre-installed and ready to use.

This container includes all necessary dependencies and provides an easy way to run Claude Code in an isolated environment.

An optional proxy can be enabled to track all the requests made by Claude Code in a local SQLite database.

Available Images

Three Docker images are available on Docker Hub, all released with matching version tags:

ImagePurposeBase
nezhar/claude-containerMain container with Claude Code CLI pre-installedNode.js 22 Alpine
nezhar/claude-proxyOptional HTTP proxy that logs all API requests to SQLitePython 3.12 Alpine
nezhar/claude-datasetteOptional web UI for visualizing and querying logged requestsDatasette + plugins

Architecture Overview

When using all three images together, the request flow looks like this:

┌─────────────────┐      ┌──────────────────┐      ┌─────────────────────┐
│ claude-container│─────▶│  claude-proxy    │─────▶│  api.anthropic.com  │
│  (Claude Code)  │      │   (HTTP Proxy)   │      │   (Anthropic API)   │
└─────────────────┘      └────────┬─────────┘      └─────────────────────┘
                                  │
                                  ▼
                         ┌─────────────────┐
                         │  requests.db    │
                         │   (SQLite)      │
                         └────────┬────────┘
                                  │
                                  ▼
                         ┌─────────────────┐
                         │claude-datasette │
                         │   (Web UI)      │
                         └─────────────────┘
                         http://localhost:8001

Standalone Usage:

  • Use claude-container alone for basic Claude Code functionality
  • Add claude-proxy when you need API request logging
  • Add claude-datasette when you want to visualize and analyze logs

Compatibility Matrix

Latest Release: 1.6.12 (Claude Code 2.1.69)

Container VersionClaude Code Version
1.0.x1.0.x
1.1.x2.0.x
1.2.x2.0.x
1.3.x2.0.x
1.4.x2.0.x
1.5.x2.1.x
1.6.x2.1.x

Quick Start

Using the Helper Script (Recommended)

The easiest way to run Claude Container is using the provided bash script. Download and install it with:

# Download the script directly from GitHub
curl -o ~/.local/bin/claude-container https://raw.githubusercontent.com/nezhar/claude-container/main/bin/claude-container

# Make it executable
chmod +x ~/.local/bin/claude-container

# Run Claude Code
claude-container

Make sure ~/.local/bin is in your PATH. Alternatively, install to /usr/local/bin:

# Download and install system-wide (requires sudo)
sudo curl -o /usr/local/bin/claude-container https://raw.githubusercontent.com/nezhar/claude-container/main/bin/claude-container
sudo chmod +x /usr/local/bin/claude-container

The script handles all Docker configuration automatically and supports additional features like API logging. Run with --help to see all available options:

claude-container --help

Optional: Enable Tab Completion

To enable bash tab completion for the claude-container command:

# Download and install completion script
mkdir -p ~/.local/share/bash-completion/completions
curl -o ~/.local/share/bash-completion/completions/claude-container https://raw.githubusercontent.com/nezhar/claude-container/main/completions/claude-container

# Reload your shell or start a new terminal session
source ~/.bashrc

Once installed, you can use tab completion with claude-container --<TAB> to see all available options

Updating to the Latest Version

To update to the latest version, simply re-download the helper script and completions:

# Update helper script (user install)
curl -o ~/.local/bin/claude-container https://raw.githubusercontent.com/nezhar/claude-container/main/bin/claude-container

# Or for system-wide install
sudo curl -o /usr/local/bin/claude-container https://raw.githubusercontent.com/nezhar/claude-container/main/bin/claude-container

# Update completions (if installed)
curl -o ~/.local/share/bash-completion/completions/claude-container https://raw.githubusercontent.com/nezhar/claude-container/main/completions/claude-container

# Verify the new version
claude-container --version

The helper script will automatically pull the latest Docker images when needed.

Using Docker Compose

Create a compose.yml file as provided in the example folder.

docker compose run claude-code claude

You will need to login for the first time, afterwards your credentials and configurations will be stored inside a bind mount volume, make sure this stays in your .gitignore.

Using Docker directly

docker run --rm -it -v "$(pwd):/workspace" -v "$HOME/.config/claude-container:/claude" -e "CLAUDE_CONFIG_DIR=/claude" nezhar/claude-container:latest claude

This will store the credentials in $HOME/.config/claude-container and will be able to reuse them after the first login.

How does the authentication work

When you run the container for the first time, you'll go through the following authentication steps:

  1. Choose Color Schema: Select your preferred terminal color scheme

    Color Schema Selection

  2. Select Login Method: Choose between Subscription or Console login (this example uses Subscription)

    Login Method Selection

  3. Generate Token: Open the provided URL in your browser to generate an authentication token, then paste it into the prompt

    Token Generation

  4. Success: You're authenticated and ready to use Claude Code

    Authentication Success

Integration with Existing Projects

To integrate Claude Container into an existing Docker Compose project, create a compose.override.yml file:

services:
  claude-code:
    image: nezhar/claude-container:latest
    volumes:
      - ./workspace:/workspace
      - ./claude-config:/claude
    environment:
      CLAUDE_CONFIG_DIR: /claude
    profiles:
      - tools

Then run Claude Code with:

# Using profiles to avoid starting by default
docker compose --profile tools run claude-code claude

This approach keeps Claude Code separate from your main application services while allowing easy access when needed.

API Request Logging Proxy

This repository includes an optional logging proxy that captures all Anthropic API requests and responses to a SQLite database. This is useful for:

  • Debugging API interactions
  • Monitoring token usage and costs
  • Analyzing request/response patterns
  • Building custom analytics tools

Running with Docker

Run Claude Container directly:

docker run --rm -it \
  -v "$(pwd):/workspace" \
  -v "$HOME/.config/claude-container:/claude" \
  -e "CLAUDE_CONFIG_DIR=/claude" \
  nezhar/claude-container:latest claude

Run with logging proxy:

# 1. Create a Docker network
docker network create claude-network

# 2. Start the proxy container
docker run -d --name claude-proxy \
  --network claude-network \
  -v "$(pwd)/proxy-data:/data" \
  -p 8080:8080 \
  nezhar/claude-proxy:latest

# 3. Run Claude Code (configured to use the proxy)
docker run --rm -it \
  --network claude-network \
  -v "$(pwd):/workspace" \
  -v "$HOME/.config/claude-container:/claude" \
  -e "CLAUDE_CONFIG_DIR=/claude" \
  -e "ANTHROPIC_BASE_URL=http://claude-proxy:8080" \
  nezhar/claude-container:latest claude

# 4. Cleanup when done
docker stop claude-proxy
docker rm claude-proxy
docker network rm claude-network

Proxy Configuration

The proxy supports the following environment variables:

  • PROXY_PORT: Port to listen on (default: 8080)
  • TARGET_API_URL: Target API URL (default: https://api.anthropic.com)
  • DB_PATH: SQLite database path (default: /data/requests.db)

Data Visualization with Datasette

This repository includes a Datasette container for exploring and visualizing the API request logs captured by the proxy. Datasette provides a web-based interface to explore your SQLite database with filtering, sorting, and export capabilities.

Features

  • Browse Request Logs: View all API requests with filtering and sorting
  • JSON Visualization: Pretty-print JSON request/response bodies
  • Analytics: Analyze request patterns, response times, and error rates
  • Export Data: Export filtered results to CSV, JSON, or Excel
  • SQL Queries: Run custom SQL queries against your data

Running with Datasette

When using Docker Compose, you can add the Datasette service to visualize your proxy data:

services:
  claude-proxy:
    image: nezhar/claude-proxy:latest
    ports:
      - "8080:8080"
    volumes:
      - ./proxy-data:/data

  claude-datasette:
    image: nezhar/claude-datasette:latest
    ports:
      - "8001:8001"
    volumes:
      - ./proxy-data:/data:ro
    depends_on:
      - claude-proxy

  claude-code:
    image: nezhar/claude-container:latest
    volumes:
      - ./workspace:/workspace
      - ./claude-config:/claude
    environment:
      CLAUDE_CONFIG_DIR: /claude
      ANTHROPIC_BASE_URL: http://claude-proxy:8080
    depends_on:
      - claude-proxy

Start the services:

docker compose up -d claude-proxy claude-datasette
docker compose run claude-code claude

Then access Datasette at http://localhost:8001 to explore your API request logs.

Using Datasette

Once Datasette is running:

  1. View All Requests: Navigate to the request_logs table to see all captured API requests
  2. Filter Data: Use the faceted filters to narrow down by HTTP method, status code, etc.
  3. Examine Details: Click on individual requests to see full headers and JSON bodies
  4. Run Queries: Use the SQL interface to run custom analytics queries
  5. Export Results: Export filtered data in various formats for further analysis

Example queries you might run:

-- Average response time by endpoint
SELECT path, AVG(duration_ms) as avg_duration, COUNT(*) as request_count
FROM request_logs
GROUP BY path
ORDER BY avg_duration DESC;

-- Requests with errors
SELECT timestamp, method, path, response_status, duration_ms
FROM request_logs
WHERE response_status >= 400
ORDER BY timestamp DESC;

-- Token usage over time (if captured in request_body)
SELECT
  DATE(timestamp) as date,
  SUM(json_extract(response_body, '$.usage.input_tokens')) as input_tokens,
  SUM(json_extract(response_body, '$.usage.output_tokens')) as output_tokens
FROM request_logs
WHERE json_extract(response_body, '$.usage') IS NOT NULL
GROUP BY date
ORDER BY date DESC;

常见问题

What is claude-container?

claude-container is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by nezhar. Container workflow for Claude Code. Complete isolation from host system while maintaining persistent credentials and workspace access. It has 163 GitHub stars.

Is claude-container safe to use?

Yes. claude-container passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install claude-container?

Clone the repository with "git clone https://github.com/nezhar/claude-container" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is claude-container written in?

claude-container is primarily written in Shell. It is open-source under nezhar on GitHub, so you can review or fork the full source.

Are there alternatives to claude-container?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-container against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情
claude-container — Claude Code AI Skill | SkillTip