🤖 基于 nanobot 的轻量级 AI 助手容器镜像
# 拉取镜像
docker pull codeyhj/nanobot:latest
# 创建配置目录和文件(必须配置 API Key)
mkdir -p .nanobot
cat > .nanobot/config.json << 'EOF'
{
"agents": {
"defaults": {
"model": "anthropic/claude-3-5-sonnet-20241022"
}
},
"providers": {
"anthropic": {
"apiKey": "sk-ant-your-anthropic-key"
}
},
"gateway": {
"host": "0.0.0.0",
"port": 18790
}
}
EOF
# 运行容器
docker run -d \
-v $(pwd)/.nanobot:/home/nanobot/.nanobot \
-p 18790:18790 \
--name nanobot \
codeyhj/nanobot:latest
⚠️ 注意:如不配置 API Key,容器会报错 Error: No API key configured. 并退出。
services:
nanobot:
image: codeyhj/nanobot:latest
container_name: nanobot
restart: unless-stopped
command: ["gateway"] # 启动 gateway 保持持久运行
ports:
- "18790:18790"
volumes:
# 挂载配置目录
- ./.nanobot:/home/nanobot/.nanobot:cached
创建 config.json,必须配置至少一个 API Key:
{
"agents": {
"defaults": {
"model": "anthropic/claude-3-5-sonnet-20241022",
"maxTokens": 8192,
"temperature": 0.7
}
},
"providers": {
"anthropic": {
"apiKey": "sk-ant-your-anthropic-key"
},
"openai": {
"apiKey": "sk-your-openai-key"
},
"deepseek": {
"apiKey": "sk-your-deepseek-key"
}
},
"gateway": {
"host": "0.0.0.0",
"port": 18790
}
}
| Provider | 获取地址 |
|---|---|
| Anthropic (Claude) | https://console.anthropic.com/ |
| OpenAI | https://platform.openai.com/ |
| DeepSeek | https://platform.deepseek.com/ |
| 容器内路径 | 说明 |
|---|---|
/home/nanobot/.nanobot | 配置目录(含 config.json、workspace 等) |
anthropic/claude-3-5-sonnet-20241022 - Claude 3.5 Sonnetopenai/gpt-4o - GPT-4odeepseek/deepseek-chat - DeepSeek V3openrouter/... - 通过 OpenRouter 使用# 查看日志
docker logs -f nanobot
# 进入容器
docker exec -it nanobot bash
# 查看状态
docker exec nanobot nanobot status
# 停止
docker stop nanobot
18790 - Gateway API 端口python:3.11-slimnanobot (非 root)linux/amd64, linux/arm64Content type
Image
Digest
sha256:3369bd99e…
Size
209.5 MB
Last updated
3 months ago
docker pull codeyhj/nanobot