Fix Ollama Connection Errors in MuleSoft by Using host.docker.internal

Developers using the MuleSoft Inference Connector to connect to a locally running Ollama instance may encounter a connection refused error when setting the base URL to http://localhost:11434/v1. This happens because the MuleSoft runtime runs inside a Docker container, where localhost refers to the container itself rather than the host machine. The fix is to replace localhost with host.docker.internal in the openAICompatibleURL connector configuration, pointing it to http://host.docker.internal:11434/v1 instead. Once corrected, the connector successfully reaches the local Ollama service and returns a valid 200 response with the model's generated output. The solution was demonstrated on Mule 4 Community kernel version 4.12.0.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in