15. Open WebUI Integration
Open WebUI is a self-hosted web interface for Ollama that provides ChatGPT-like features: conversation history, model switching, image uploads, and more.
Installation Methods
Docker (recommended):
docker run -d -p 3000:8080 \\
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \\
-v open-webui:/app/backend/data \\
--name open-webui \\
ghcr.io/open-webui/open-webui:main
Docker Compose (see Chapter 14).
Configuration Options
Open WebUI uses environment variables for configuration:
| Variable | Default | Description |
|---|---|---|
OLLAMA_BASE_URL |
http://localhost:11434 |
Ollama API URL |
WEBUI_SECRET_KEY |
Auto | Session encryption key |
OLLAMA_API_BASE_URL |
OLLAMA_BASE_URL + /api |
API endpoint |
ENABLE_IMAGE_GENERATION |
false |
Enable image generation |
For Docker, pass these with -e:
docker run -d -p 3000:8080 \\
-e OLLAMA_BASE_URL=http://192.168.1.100:11434 \\
-e WEBUI_SECRET_KEY=mysecretkey \\
ghcr.io/open-webui/open-webui:main
Authentication
Open WebUI supports user authentication out of the box. On first access, you create an admin account. Subsequent users can be invited or registered based on admin settings.
To disable authentication for local-only setups:
environment:
- WEBUI_AUTH=False
Custom Modelfiles Integration
Open WebUI detects custom models created with Modelfiles automatically. If you deploy Modelfiles in a directory:
services:
ollama:
image: ollama/ollama:latest
volumes:
- ./Modelfiles:/root/.ollama/models/Modelfile
Restart Ollama after adding Modelfiles-the interface picks up new models after a refresh.
Troubleshooting
Open WebUI cannot connect to Ollama:
- Verify Ollama is running:
curl http://localhost:11434 - Check the
OLLAMA_BASE_URLenvironment variable - For Docker networking, use
host.docker.internalon Windows/Mac, or the service name (ollama) if using Docker Compose
Models not showing in the dropdown:
- Pull the model inside the Ollama container:
docker exec ollama ollama pull llama3.2:1b - Check
docker exec ollama ollama listto verify - Refresh the Open WebUI page
Deploy Open WebUI with Ollama via Docker Compose. Create a custom Modelfile, place it in the Modelfiles directory, restart the Ollama container, and verify the custom model appears in Open WebUI's model selector.