cd /news/ai-tools/use-host-docker-internal-to-reach-lo… · home topics ai-tools article
[ARTICLE · art-128335] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=· neutral

Use host.docker.internal to reach local Ollama from Mule

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.

by read1 min views3 publishedSep 13, 2026

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.

{
  "prompt": "Reply with exactly one word: pong"
}
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:http="http://www.mulesoft.org/schema/mule/http"
      xmlns:ms-inference="http://www.mulesoft.org/schema/mule/ms-inference"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="
        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
        http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
        http://www.mulesoft.org/schema/mule/ms-inference http://www.mulesoft.org/schema/mule/ms-inference/current/mule-ms-inference.xsd">

  <http:listener-config name="http-listener-config">
    <http:listener-connection host="0.0.0.0" port="8081" />
  </http:listener-config>

  <ms-inference:text-generation-config name="ollama-openai-compatible">
    <ms-inference:openai-compatible-connection
        openAICompatibleModelName="qwen2.5:14b"
        openAICompatibleURL="http://host.docker.internal:11434/v1"
        apiKey="ollama"
        maxTokens="16"
        temperature="0"
        topP="1"
        timeout="120" />
  </ms-inference:text-generation-config>

  <flow name="ask">
    <http:listener config-ref="http-listener-config" path="/ask" />
    <ms-inference:chat-answer-prompt config-ref="ollama-openai-compatible">
      <ms-inference:prompt>#[payload.prompt]</ms-inference:prompt>
    </ms-inference:chat-answer-prompt>
  </flow>
</mule>
{"response": {"response": "Pong"}, "status": 200}

The response field contains the model output, and status shows 200.

Using http://localhost:11434/v1 as the base URL causes a connection refused error.

I configure openAICompatibleURL to http://host.docker.internal:11434/v1 in the connector configuration.

Runs shown: Mule 4 Community kernel 4.12.0

104 DataWeave patterns + 8 Exchange modules with 208 MUnit tests: github.com/shakarbisetty/mulesoft-cookbook | 60-second walkthroughs: youtube.com/@SanThaParv

── more in #ai-tools 4 stories · sorted by recency
── more on @mulesoft 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/use-host-docker-inte…] indexed:0 read:1min 2026-09-13 ·