#21096: [codex] Add host-gateway + Ollama API env defaults to compose
docker
size: XS
Cluster:
Docker and Deployment Improvements
## Summary
This change updates `docker-compose.yml` so the OpenClaw gateway and CLI containers can reliably reach a host-installed Ollama instance without extra local tweaks.
## Problem
Local Ollama access from containers can fail or be inconsistent across Linux Docker environments when `host.docker.internal` is not mapped. In addition, the Ollama API key/env behavior was implicit, which could create mismatches between provider config and container runtime environment.
## User Impact
When users configure Ollama as a local provider, containerized OpenClaw commands may fail to connect to Ollama or behave inconsistently depending on host networking setup.
## Root Cause
- `host.docker.internal` was not explicitly mapped in this compose file.
- `OLLAMA_API_KEY` was not explicitly set in container env for gateway/CLI services.
## Fix
- Added `extra_hosts` mapping for both relevant services:
- `host.docker.internal:host-gateway`
- Added explicit env default for both services:
- `OLLAMA_API_KEY: ${OLLAMA_API_KEY:-ollama-local}`
## Validation
- Rendered compose config successfully:
- `docker compose -f docker-compose.yml config`
- Confirmed only `docker-compose.yml` was committed for this change.
## Notes
- Left unrelated untracked local backup file (`.env.bak-20260217-104800`) out of this PR.
Most Similar PRs
#17104: fix(clawdock): include docker-compose.extra.yml in compose commands
by Limitless2023 · 2026-02-15
67.2%
#8710: fix: Docker 安全強化與 Ollama 整合
by bluefishs · 2026-02-04
66.5%
#4782: fix: Auto-discover Ollama models without requiring explicit API key
by spiceoogway · 2026-01-30
64.7%
#18587: fix(ollama): improve timeout handling and cooldown logic for local ...
by manthis · 2026-02-16
64.4%
#12504: fix: allow docker cli container to connect to gateway
by bvanderdrift · 2026-02-09
64.1%
#14061: fix(gateway): Docker CLI container gateway connectivity and auth
by gokusenz · 2026-02-11
63.7%
#7278: feat(ollama): optimize local LLM support with auto-discovery and ti...
by alltomatos · 2026-02-02
62.5%
#23478: feat : add VPS deployment instructions for Ollama and enhance relat...
by jayy-77 · 2026-02-22
62.2%
#23776: feat(ollama): auto-register Ollama provider with placeholder key an...
by jayy-77 · 2026-02-22
61.5%
#6638: fix: make Dockerfile work on container platforms (Render, Railway, ...
by kaizen403 · 2026-02-01
61.4%