Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Open WebUI Can't Connect to Ollama in Docker: The Fixes

说明与用途

Open WebUI 在 Docker 中无法连接 Ollama,原因是 URL 错误和网络隔离。将 OLLAMA_BASE_URL 设置为正确地址,在 Linux 主机上添加 host.docker.internal,并确保 Ollama 监听非本地接口。随后 UI 将显示模型并通过连接检查。

问题

Open WebUI cannot reach Ollama when both run in Docker, resulting in an empty model picker or failed admin connection check.

结果

After configuring the correct Ollama URL and ensuring network visibility, Open WebUI can list models and pass admin connection checks.

工作流

  • 1. Identify where Ollama runs (same Compose file, host, or another machine).
  • 2. Set OLLAMA_BASE_URL to the appropriate URL: http://ollama:11434 for same Compose, http://host.docker.internal:11434 for host (with extra_hosts on Linux), or http://<host-ip>:11434 for another machine.
  • 3. If using host, add --add-host host.docker.internal:host-gateway (or in Compose - host.docker.internal:host-gateway). Ensure Ollama listens on an address other than 127.0.0.1 (e.g., 0.0.0.0).
  • 4. Test connectivity from inside the Open WebUI container: docker exec open-webui curl -s http://ollama:11434 should return "Ollama is running" and curl -s http://host.docker.internal:11434/api/version should return a JSON version string.
  • 5. If OLLAMA_BASE_URL change appears ineffective, update the value in Open WebUI Admin Panel > Settings > Connections, as the first value is persisted in the database.
  • 6. Optionally, monitor the connection with an HTTP monitor like Uptime Kuma from a container with the same network access.

证据

Open WebUI shows no models and admin connection check reports "Ollama: Network Problem".

来源

docker exec open-webui curl -s http://ollama:11434 should return "Ollama is running".

来源

OLLAMA_BASE_URL set to http://ollama:11434 when both run in one Compose file.

来源

  • 记录日期: 2026-10-16T07:56:01.847Z