fix(docker): enable host.docker.internal for local providers#68702
fix(docker): enable host.docker.internal for local providers#68702skolez wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds The change is minimal, additive, and well-reasoned. Because Confidence Score: 5/5Safe to merge — config-only and docs-only change with no runtime code touched. The No files require special attention. Reviews (1): Last reviewed commit: "fix(docker): map host.docker.internal fo..." | Re-trigger Greptile |
8ca47bb to
47cab92
Compare
|
Maintainer review note: the Compose change itself looks right, but I do not think this should land as-is yet. Two issues from local review:
Evidence checked: PR diff only touches |
|
Codex automated review: keeping this open. Keep this PR open. The linked Docker/local-provider bug is real and current main still lacks the host-gateway mapping and Docker provider guidance, but this PR should not be closed or merged as-is because a maintainer identified a concrete docs error for LM Studio binding plus a changelog policy violation. The Compose change appears directionally correct and limited; the best path is a small revision, not cleanup closure. Best possible solution: Keep this PR open and ask for a small revision: update the Docker docs to tell LM Studio users to enable network serving explicitly, such as the GUI What I checked:
Remaining risk / open question:
Codex Review notes: model gpt-5.5, reasoning high; reviewed against 646a268d2710. |
|
Closing as superseded by 66f4b52 on main. Thanks @skolez for the PR. I kept the core Compose direction from this PR and added the missing pieces from review:
Validation:
|
Summary
http://127.0.0.1:1234/http://127.0.0.1:11434. Inside the container that resolves to the container itself, not the host, so every model call silently fails.host.docker.internal→host-gatewayin the bundleddocker-compose.yml(so the alias works on Linux, not just Docker Desktop) and added a "Connecting to host services" subsection todocs/install/docker.mddocumenting the correct base URLs for LM Studio and Ollama.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
docker-compose.ymldid not declareextra_hosts: ["host.docker.internal:host-gateway"], so on Linux the alias does not resolve (Docker Desktop sets it implicitly; Docker Engine does not). The Docker install docs also did not call out the container-vs-host loopback gotcha for local AI providers, so users entering127.0.0.1had no hint why their setup silently failed.Regression Test Plan (if applicable)
N/A — no runtime/test code is touched. The change is a YAML config addition and a docs section.
User-visible / Behavior Changes
http://host.docker.internal:<port>now resolves to the host gateway on Linux (it already worked on Docker Desktop). Users following the docs can now point LM Studio/Ollama setup at the correct URL on any platform.docs/install/docker.md.Diagram (if applicable)
Security Impact (required)
extra_hosts: ["host.docker.internal:host-gateway"]only resolves a hostname to the existing host gateway IP; it does not open new ports, expose new services, or grant new privileges. Same alias Docker Desktop already provides implicitly.Repro + Verification
Environment
openclaw-gatewaycontainerdocker-compose.ymlSteps
./scripts/docker/setup.shon a Linux Docker Engine host.http://127.0.0.1:1234(orhttp://127.0.0.1:11434).Expected
http://host.docker.internal:<port>instead, and that hostname resolves correctly on both Docker Desktop and Linux Docker Engine.Actual
host.docker.internalgave name resolution errors; entering127.0.0.1reached the container loopback (no provider). Either way, model calls silently failed.Evidence
Reproduction and root cause are well-documented in #68684 (filed by @safrano9999). No new automated coverage added — this PR is config + docs only.
Human Verification (required)
docker-compose.yml,docs/install/docker.md, andCHANGELOG.md.extra_hosts: ["host.docker.internal:host-gateway"]matches the syntax already in use elsewhere in this repo (extensions/qa-lab/src/docker-harness.ts:125,src/agents/sandbox/config-hash.test.ts:17).openclaw-clishares the gateway's network namespace (network_mode: "service:openclaw-gateway"), so addingextra_hostsonly on the gateway service is sufficient.host.docker.internalalready resolves implicitly; addingextra_hostsis a harmless no-op.host-gatewaymagic value is supported since Docker 20.10 (released 2020-12), which is well below the project's existing Docker baseline.Review Conversations
Compatibility / Migration
extra_hostsis additive.Risks and Mitigations
host-gatewaymagic value) might fail to start the container with the newextra_hosts.