deancourse

Claude Code Docker Container Demo — DevOps skill for Claude Code

DevOps community

在網路受限的 Docker 容器(Dev Container)中安全執行 Claude Code 的沙箱範本:透過 iptables/ipset 防火牆白名單限制對外連線,隔離 AI Agent 的讀寫與執行.

How to install Claude Code Docker Container Demo

This entry records only its repository, not the path inside it, so there is no exact command to give. Open deancourse/claude-code-docker-container-demo and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Code Docker Container Demo does

在網路受限的 Docker 容器(Dev Container)中安全執行 Claude Code 的沙箱範本:透過 iptables/ipset 防火牆白名單限制對外連線,隔離 AI Agent 的讀寫與執行。改自 Anthropic 官方 .devcontainer。

Alternatives in DevOps

  • Docker 71.9k ★
  • Claude Code Router — Use Claude Code as the foundation for coding infrastructure, allowing you to decide how to interact with the m 30.1k ★
  • Claude Code GitHub Actions — by Anthropic - Official GitHub Actions integration for Claude Code with examples and documentation for automat 6.4k ★

README

Claude Code Docker 沙箱(Dev Container)

Claude Code Dev Container node:20 Firewall Editor License: MIT PRs welcome

在一個**網路受限的 Docker 容器**裡執行 [Claude Code](https://docs.anthropic.com/en/docs/claude-code),讓 AI Agent 可以在隔離環境中讀寫程式碼、執行指令,同時透過防火牆把對外連線限制在少數白名單網域,降低資料外洩與誤操作的風險。

本專案改自 Anthropic 官方的 `.devcontainer` [參考實作](https://github.com/anthropics/claude-code/tree/main/.devcontainer)。


目錄結構

.
├── .devcontainer/
│   ├── devcontainer.json   # Dev Container 設定(映像、掛載、環境變數、啟動指令)
│   ├── Dockerfile          # 容器映像:Node 20 + 開發工具 + Claude Code CLI
│   └── init-firewall.sh    # 啟動時套用的 iptables/ipset 防火牆規則
├── .claude/
│   └── settings.local.json # 專案層級的本機設定(權限白名單等)
└── README.md

需求


快速開始

  1. 用 IDE 開啟此資料夾。
  2. F1Dev Containers: Reopen in Container
  3. 第一次會建置映像(image)並執行 init-firewall.sh 套用防火牆,請稍候。
  4. 容器開好後,在整合終端機執行:
    claude
  5. 依照指示完成登入即可開始使用。

你的程式碼透過 bind mount 掛載在容器內的 `/workspace`,在容器內的修改會直接反映到本機檔案。


這個容器裡有什麼