{"slug": "use-host-docker-internal-to-reach-local-ollama-from-mule", "title": "Use host.docker.internal to reach local Ollama from Mule", "summary": "A developer documented that MuleSoft's Inference Connector fails with a connection-refused error when pointed at a local Ollama instance via http://localhost:11434/v1, and that switching the openAICompatibleURL to http://host.docker.internal:11434/v1 resolves it. The working configuration runs the qwen2.5:14b model through the OpenAI-compatible connection in Mule 4 Community kernel 4.12.0, returning a 200 status with the model output in the response field.", "body_md": "The flow failed with a connection refused error when the configuration used `http://localhost:11434/v1` as the base URL. The MuleSoft Inference Connector enables text generation workflows [docs](https://docs.mulesoft.com/mulesoft-inference-connector/latest/).\n\n```\n{\n  \"prompt\": \"Reply with exactly one word: pong\"\n}\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<mule xmlns=\"http://www.mulesoft.org/schema/mule/core\"\n      xmlns:http=\"http://www.mulesoft.org/schema/mule/http\"\n      xmlns:ms-inference=\"http://www.mulesoft.org/schema/mule/ms-inference\"\n      xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n      xsi:schemaLocation=\"\n        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd\n        http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd\n        http://www.mulesoft.org/schema/mule/ms-inference http://www.mulesoft.org/schema/mule/ms-inference/current/mule-ms-inference.xsd\">\n\n  <http:listener-config name=\"http-listener-config\">\n    <http:listener-connection host=\"0.0.0.0\" port=\"8081\" />\n  </http:listener-config>\n\n  <ms-inference:text-generation-config name=\"ollama-openai-compatible\">\n    <ms-inference:openai-compatible-connection\n        openAICompatibleModelName=\"qwen2.5:14b\"\n        openAICompatibleURL=\"http://host.docker.internal:11434/v1\"\n        apiKey=\"ollama\"\n        maxTokens=\"16\"\n        temperature=\"0\"\n        topP=\"1\"\n        timeout=\"120\" />\n  </ms-inference:text-generation-config>\n\n  <flow name=\"ask\">\n    <http:listener config-ref=\"http-listener-config\" path=\"/ask\" />\n    <ms-inference:chat-answer-prompt config-ref=\"ollama-openai-compatible\">\n      <ms-inference:prompt>#[payload.prompt]</ms-inference:prompt>\n    </ms-inference:chat-answer-prompt>\n  </flow>\n</mule>\n{\"response\": {\"response\": \"Pong\"}, \"status\": 200}\n```\n\nThe `response` field contains the model output, and `status` shows 200.\n\nUsing `http://localhost:11434/v1` as the base URL causes a connection refused error.\n\nI configure `openAICompatibleURL` to `http://host.docker.internal:11434/v1` in the connector configuration.\n\nRuns shown: Mule 4 Community kernel 4.12.0\n\n104 DataWeave patterns + 8 Exchange modules with 208 MUnit tests: github.com/shakarbisetty/mulesoft-cookbook | 60-second walkthroughs: youtube.com/@SanThaParv", "url": "https://wpnews.pro/news/use-host-docker-internal-to-reach-local-ollama-from-mule", "canonical_source": "https://dev.to/thasha/use-hostdockerinternal-to-reach-local-ollama-from-mule-1p02", "published_at": "2026-09-13 14:58:47+00:00", "updated_at": "2026-09-13 15:14:26.678000+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "developer-tools", "ai-infrastructure"], "entities": ["MuleSoft", "Ollama", "Mule 4", "qwen2.5:14b", "MuleSoft Inference Connector"], "alternates": {"html": "https://wpnews.pro/news/use-host-docker-internal-to-reach-local-ollama-from-mule", "markdown": "https://wpnews.pro/news/use-host-docker-internal-to-reach-local-ollama-from-mule.md", "text": "https://wpnews.pro/news/use-host-docker-internal-to-reach-local-ollama-from-mule.txt", "jsonld": "https://wpnews.pro/news/use-host-docker-internal-to-reach-local-ollama-from-mule.jsonld"}}