15. Open WebUI Integration

Chapter 15 of 20 · 20 min

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:

  1. Verify Ollama is running: curl http://localhost:11434
  2. Check the OLLAMA_BASE_URL environment variable
  3. For Docker networking, use host.docker.internal on Windows/Mac, or the service name (ollama) if using Docker Compose

Models not showing in the dropdown:

  1. Pull the model inside the Ollama container: docker exec ollama ollama pull llama3.2:1b
  2. Check docker exec ollama ollama list to verify
  3. Refresh the Open WebUI page
EXERCISE

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.