Open WebUI: Failed to fetch from /ollama (cannot reach Ollama backend)
Cause
Environment: Open WebUI (Docker) connecting to a separately-running Ollama instance.
Severity: high — WebUI is unusable until reachable.
- Ollama bound to
127.0.0.1:11434so the Open WebUI container can't reach it (containers see127.0.0.1as their own loopback) OLLAMA_BASE_URLenv var in Open WebUI not set or pointing wrong- Docker networks isolated (Open WebUI on
bridge, Ollama on a different one) - Firewall blocking 11434 between host and container
- Ollama not running at all
Solution
1. Bind Ollama to all interfaces so the container can reach it:
OLLAMA_HOST=0.0.0.0:11434 ollama serve
# Or persist via systemd:
sudo systemctl edit ollama
# [Service]
# Environment="OLLAMA_HOST=0.0.0.0:11434"
sudo systemctl daemon-reload && sudo systemctl restart ollama
2. Point Open WebUI at the host via OLLAMA_BASE_URL:
docker run -d --name open-webui \
-p 3000:8080 \
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
-v open-webui:/app/backend/data \
--restart always \
ghcr.io/open-webui/open-webui:main
On Linux without Docker Desktop, use the host's LAN IP (e.g. http://192.168.1.10:11434) or pass --add-host=host.docker.internal:host-gateway.
3. Run both on a shared bridge network (cleanest):
docker network create ai-net
docker run -d --network ai-net --name ollama -p 11434:11434 ollama/ollama
docker run -d --network ai-net --name open-webui \
-e OLLAMA_BASE_URL=http://ollama:11434 \
-p 3000:8080 ghcr.io/open-webui/open-webui:main
4. Test connectivity from inside the WebUI container:
docker exec -it open-webui curl http://host.docker.internal:11434/api/tags
A 200 with a JSON models array means the link is good.
5. Check firewall if on a Linux host with ufw/firewalld:
sudo ufw allow from 172.17.0.0/16 to any port 11434
Related errors
Did this fix it?
If your case was different, email Contact support with what you saw and we'll update the page. If it worked but took different commands on your platform, we want to know that too.