HOW-TO · SET

How to configure Open WebUI with Ollama backend

intermediate10 minBy Eruo Fredoline
Target environment
Ubuntu 24.04 · Ollama 0.4.xWindows 11 · Ollama 0.4.xmacOS 15 · Ollama 0.4.x
PREREQUISITES

Open WebUI and Ollama both running in Docker

What this does

Links the Open WebUI container to the Ollama API endpoint so chat requests route through the UI to local model inference. After this guide all prompt submissions in the WebUI reach Ollama and return generated responses.

Steps

  1. Verify the Ollama API endpoint is reachable from the Open WebUI container.

    docker exec open-webui curl -s http://host.docker.internal:11434/api/tags
    

    Expected output: JSON object containing a models array.

  2. Set the OLLAMA_BASE_URL environment variable explicitly.

    # Update compose.yaml if needed and restart
    docker compose -f ~/open-webui/compose.yaml up -d
    

    Expected output: Container open-webui Running after the update.

  3. Enable model caching through the UI settings panel.

    • Navigate to Settings > General
    • Set Default Model to a model visible in Ollama
    • Enable Keep Alive to a non-zero value (e.g., 300 seconds)
  4. Test end-to-end from the WebUI. Submit a simple prompt and confirm a response returns.

Verification

curl -s http://localhost:8080/ollama/api/tags | python3 -m json.tool
# Expected: List of model names visible to Open WebUI

Common failures

  • Connection refused in Open WebUIOLLAMA_BASE_URL resolves to a host Ollama is not binding on. Set OLLAMA_HOST=0.0.0.0 in Ollama and restart.
  • Empty models list in WebUI — Network isolation. Add both containers to the same Docker network.
  • Model returns "error: loading model" — The model file may be corrupted. Re-pull with docker exec ollama ollama pull <model-name>.
  • Slow first response — Set Keep Alive to 300 in Settings > General.
  • WebUI shows 403 Forbidden — Add OLLAMA_API_BASE_URL=http://host.docker.internal:11434 and restart.

Operator checkpoint

Before treating this as solved, write down the local runtime, model or package version, hardware/backend if relevant, and the verification output. This keeps the guide useful as a Will-It-Run style decision instead of a one-off command transcript.

Related guides

RELATED GUIDES