#8710: fix: Docker 安全強化與 Ollama 整合
docker
stale
Cluster:
Docker and Deployment Improvements
## Summary
- **`.dockerignore`**: 排除敏感檔案 (.env, secrets/, *.pem, *.key)
- **`docker-compose.yml`**:
- 新增 Ollama 服務支援本地 LLM (8G RAM 限制)
- 安全強化 (OWASP 指南): `no-new-privileges`, `cap_drop: ALL`
- 健康檢查與資源限制
- 網路綁定改為 loopback + LAN IP
- 日誌輪替配置 (10MB × 3) 防止磁碟爆滿
- 新增 volumes: `ollama_data`, `openclaw_agents`
## Test plan
- [ ] 驗證 `docker compose up` 正常啟動
- [ ] 確認 Ollama 服務健康檢查通過
- [ ] 測試 Gateway 健康檢查端點
- [ ] 確認敏感檔案未被包含在 Docker image 中
🤖 Generated with [Claude Code](https://claude.ai/code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR tightens Docker defaults and adds an optional local LLM stack:
- `.dockerignore` now excludes common secret material (`.env*`, `secrets/`, `*.pem`, `*.key`) while keeping `.env.example`.
- `docker-compose.yml` adds an `ollama` service, wires the gateway to it via `OLLAMA_HOST`, and applies container hardening (`no-new-privileges`, `cap_drop: ALL`, tmpfs for `/tmp`), plus healthchecks, logging rotation, and additional volumes.
The changes mostly live in compose configuration and are intended to make local deployments safer and more robust, but there are a few portability/reproducibility pitfalls (hard-coded LAN bind, `deploy:` limits in non-Swarm compose, etc.) that could surprise users.
<h3>Confidence Score: 3/5</h3>
- This PR is likely safe to merge, but has a few configuration choices that can break `docker compose up` in common environments.
- Core changes are limited to Docker ignore/compose configuration and align with the PR’s stated goals, but hard-coded host IP bindings and use of Swarm-only `deploy:` resource limits can cause runtime failures or provide a false sense of enforcement for typical Compose users.
- docker-compose.yml (port bindings, healthcheck portability, resource limit semantics)
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#8050: fix: docker hardening
by christopherbarnett96 · 2026-02-03
83.0%
#11478: Chore: add Dockerfile HEALTHCHECK and debug-log silent catch blocks
by U-C4N · 2026-02-07
78.3%
#9190: feat(docker): Add autonomous container self-restart and runtime pac...
by alexdredmon · 2026-02-05
77.9%
#7133: feat: Automated Docker setup with environment-based configuration
by synetalsolutions · 2026-02-02
77.8%
#9999: Docker: fix token mismatch and add dev setup workflow
by benclarkeio · 2026-02-06
77.7%
#13950: fix(docker): add browser sidecar service and health checks
by n24q02m · 2026-02-11
77.6%
#7278: feat(ollama): optimize local LLM support with auto-discovery and ti...
by alltomatos · 2026-02-02
77.5%
#12504: fix: allow docker cli container to connect to gateway
by bvanderdrift · 2026-02-09
77.4%
#13953: feat(docker): add .env template and improve Dockerfile
by n24q02m · 2026-02-11
76.9%
#15466: Vps setup merge
by tsekula · 2026-02-13
76.6%