fix(defaults): resolve host gateway via Docker for Colima/Rancher Desktop#432
Merged
Conversation
bussyjd
approved these changes
May 6, 2026
1e32841 to
80665ea
Compare
Contributor
|
lgtm, won't merge pre 0.9.0 as idk how many non docker desktop people there are on mac. can go in after. we can also tip docker desktop users to increase their resources if they have the defaults which are too tight |
…ktop OllamaHostIPForBackend hardcoded the Docker Desktop magic gateway IP (192.168.65.254) on darwin+k3d. On Colima and Rancher Desktop the host gateway lives on a different bridge (e.g. 192.168.5.2 for Colima's default profile), so the rendered Endpoints object pointed at an IP no pod could reach. The Ollama Service silently timed out for every LiteLLM call, surfaced upstream as "provider rejected the request schema or tool payload" in OpenClaw. Replace the hardcoded fallback with a Docker-based lookup that resolves host.docker.internal from inside a transient alpine container. All three macOS Docker runtimes (Docker Desktop, Colima, Rancher Desktop) expose host.docker.internal in containers and map it to whatever gateway their VM is using, so the same resolution works everywhere. Falls back to --add-host=host.docker.internal:host-gateway and finally to the Docker Desktop magic IP for offline / docker-CLI-missing setups. Also add a "Minimum local model size" note to the README explaining that 1B-4B and *-coder Ollama variants do not handle the structured tool-calling channel reliably and recommending llama3.1:8b / qwen3:8b / qwen2.5:7b for the agent role. Tested on Colima (default profile, 4 CPU 8GiB, k3d backend): the new resolver returns 192.168.5.2 in ~400ms, the rendered Ollama Endpoints becomes reachable from in-cluster pods, and OpenClaw chat goes through the full LiteLLM -> Ollama -> tool-call round trip. Docker Desktop verification still pending (someone with Docker Desktop needed to confirm host.docker.internal resolution returns the expected 192.168.65.254 via the new code path).
80665ea to
95e63f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OllamaHostIPForBackendhardcoded the Docker Desktop magic gateway IP (192.168.65.254) ondarwin+k3d. On Colima and Rancher Desktop the host gateway lives on a different bridge (e.g.192.168.5.2for Colima's default profile), so the rendered OllamaEndpointspointed at an IP no pod could reach. The Service silently timed out for every LiteLLM call, surfaced upstream in OpenClaw as the cryptic:This PR resolves the host gateway by running a transient
alpine:3container that printshost.docker.internalfrom inside Docker — works the same on Docker Desktop, Colima, and Rancher Desktop because all three exposehost.docker.internalinside containers (mapping it to whatever bridge IP their VM uses).Resolution order on
darwin+k3d:docker run --rm alpine:3 getent hosts host.docker.internal→ falls back to--add-host=host.docker.internal:host-gatewayfor stricter setups.192.168.65.254) as a last resort, so installs without a workingdockerCLI still behave as before.docker0/br-*bridge fallback).Also adds a "Minimum local model size" note to the README. The stack relies heavily on tool-calling, and 1B–4B /
*-coderOllama variants either return raw JSON incontentor hallucinate tool failures. Recommendsllama3.1:8b/qwen3:8b/qwen2.5:7b(instruct) for the agent role.Why this happened
net.LookupHost("host.docker.internal")runs on the host machine, where the name is not resolvable (it only exists inside Docker containers). The function therefore always fell through toDockerDesktopGatewayIP(). On Docker Desktop that IP happens to be correct; on Colima/Rancher it's wrong, and the cluster gets a black-hole Endpoint.Test plan
go test ./...(unit suite, full repo) — all greengo vet ./internal/defaults/...— cleangofmt -l— cleanResolveHostGatewayViaDocker()returns192.168.5.2in ~400msOllamaHostIPForBackend("k3d")returns192.168.5.2Endpointsbecomes reachable from in-cluster podsllama3.1:8b192.168.65.254(the magic IP fallback is still in place, so behaviour should be identical even if Docker resolution fails)Notes
obol stack initadds ~400 ms of latency. Acceptable; only happens at init/refresh.alpine:3is auto-pulled if missing (~7 MB).DockerDesktopGatewayIP()is preserved as a public symbol with an updated doc comment, sinceinternal/stack/stack.gostill re-exports it.