Fix: Open WebUI Connection Refused, OpenAI Network Problem & Ollama Not Found
Fix: Open WebUI Connection Refused, OpenAI Network Problem & Ollama Not Found
When opening Open WebUI, you encounter red toast notifications stating “Connection Refused”, “OpenAI Network Problem”, or the model selector dropdown shows “No models available” / “Ollama Not Found”.
Quick Fix
Inside your docker-compose.yml, change OLLAMA_BASE_URL from localhost or 127.0.0.1 to the Docker service name (http://ollama:11434), and set OLLAMA_HOST=0.0.0.0 on the Ollama service:
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
environment:
- OLLAMA_HOST=0.0.0.0
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
environment:
- OLLAMA_BASE_URL=http://ollama:11434
- OPENAI_API_BASE_URL=http://ollama:11434/v1
Symptoms & Common Error Messages
- “Connection Refused” Notification: Open WebUI UI loads, but generating a chat response immediately fails.
- “OpenAI Network Problem”: Appears when Open WebUI attempts to connect to an OpenAI-compatible endpoint (like vLLM or Ollama
/v1) running on the same server. - Empty Model Selector: Dropdown says “No models available” despite models existing in
/root/.ollama. - Container Log Trace:
ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=11434): Max retries exceeded with url: /api/tags (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object>: Failed to establish a new connection: [Errno 111] Connection refused'))
Root Causes
localhostAmbiguity in Containers:localhostinsideopen-webuirefers to its own container sandbox, not the host machine or adjacent containers.- Ollama Default Binding: By default, standalone Ollama binds to
127.0.0.1, which refuses incoming packets from the Docker bridge gateway. SettingOLLAMA_HOST=0.0.0.0is required. - Network Isolation: The two containers were launched in separate Compose files without a shared network bridge.
Complete Verified docker-compose.yml
version: '3.8'
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
ports:
- "11434:11434"
volumes:
- ollama_models:/root/.ollama
environment:
- OLLAMA_HOST=0.0.0.0
- OLLAMA_KEEP_ALIVE=24h
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
networks:
- ai_net
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
restart: unless-stopped
ports:
- "3000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
- WEBUI_SECRET_KEY=generate_a_random_secret_string_here
volumes:
- openwebui_data:/app/backend/data
depends_on:
- ollama
networks:
- ai_net
volumes:
ollama_models:
openwebui_data:
networks:
ai_net:
driver: bridge
Diagnostic Verification Steps
# 1. Test Ollama API response from the host
curl http://localhost:11434/api/tags
# 2. Test connectivity from INSIDE the Open WebUI container to Ollama
docker exec -it open-webui curl -I http://ollama:11434/api/tags
# 3. Pull a test model if none are installed
docker exec -it ollama ollama run llama3.2:3b "Hello"
Related Guides & Blueprints
- Blueprint: Private AI Stack: Ollama, Open WebUI & OPNsense
- Tunneling: Fix: Cloudflare Tunnel 502 Bad Gateway with Open WebUI
- GPU Detection: Fix: Ollama GPU Not Detected in Docker
OpsNexusAI Engineering
Verified Lab PublicationOpsNexusAI is a technical laboratory dedicated to sovereign AI infrastructure. Every implementation guide and architectural blueprint published here is tested on physical hardware and isolated networks. Our team specializes in the deployment of private LLMs, network hardening with OPNsense, and enterprise-grade automation patterns.
Join the OpsNexus Brief
Get technical teardowns on sovereign AI architectures delivered to your inbox.