How to configure Open WebUI with Ollama backend
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
Verify the Ollama API endpoint is reachable from the Open WebUI container.
docker exec open-webui curl -s http://host.docker.internal:11434/api/tagsExpected output: JSON object containing a models array.
Set the
OLLAMA_BASE_URLenvironment variable explicitly.# Update compose.yaml if needed and restart docker compose -f ~/open-webui/compose.yaml up -dExpected output:
Container open-webui Runningafter the update.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)
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 WebUI —
OLLAMA_BASE_URLresolves to a host Ollama is not binding on. SetOLLAMA_HOST=0.0.0.0in 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:11434and 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.