TL;DR
Open WebUI is a self-hosted web interface for running local LLMs through Ollama, providing a ChatGPT-like experience without cloud dependencies. This guide walks you through Docker-based deployment, configuration, and integration with local models.
What you’ll accomplish: Deploy Open WebUI in under 10 minutes using Docker Compose, connect it to Ollama for model inference, configure authentication, and set up persistent storage for chat history and model configurations.
Prerequisites: A Linux system (Ubuntu 22.04+ or Debian 12+ recommended) with Docker Engine 24.0+ and Docker Compose v2, at least 8GB RAM (16GB+ for running 7B+ parameter models), and Ollama installed locally or accessible via network.
Quick start command:
docker run -d -p 3000:8080 \
-v open-webui:/app/backend/data \
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
--name open-webui \
--restart always \
ghcr.io/open-webui/open-webui:main
This single command pulls the latest Open WebUI image, exposes it on port 3000, creates a persistent volume for data, and connects to Ollama running on your host machine.
Key topics covered: Docker Compose configuration with environment variables, connecting to local and remote Ollama instances, configuring reverse proxies (Nginx, Caddy, Traefik), setting up authentication with OAuth providers, managing model downloads and updates, implementing rate limiting and resource quotas, backup strategies for chat history, and monitoring with Prometheus exporters.
Security considerations: Open WebUI runs entirely on your infrastructure—no telemetry, no external API calls unless you explicitly configure them. All chat data stays local. However, always validate any AI-generated Docker commands or configuration snippets before applying them to production systems, as LLMs can hallucinate incorrect flags or deprecated options.
Core Steps
Start by pulling the official Open WebUI image from Docker Hub:
docker pull ghcr.io/open-webui/open-webui:main
For production environments, pin to a specific version instead of using main:
docker pull ghcr.io/open-webui/open-webui:v0.3.8
Create Persistent Storage
Open WebUI stores user data, chat history, and model configurations in a volume. Create a dedicated directory:
mkdir -p ~/open-webui/data
chmod 700 ~/open-webui/data
Launch the Container
Run Open WebUI with volume mounting and port mapping:
docker run -d \
--name open-webui \
-p 3000:8080 \
-v ~/open-webui/data:/app/backend/data \
--restart unless-stopped \
ghcr.io/open-webui/open-webui:v0.3.8
This exposes the interface on http://localhost:3000. For Ollama integration on the same host, add network access:
docker run -d \
--name open-webui \
-p 3000:8080 \
-v ~/open-webui/data:/app/backend/data \
--add-host=host.docker.internal:host-gateway \
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
--restart unless-stopped \
ghcr.io/open-webui/open-webui:v0.3.8
Verify Installation
Check container status:
docker ps | grep open-webui
docker logs open-webui
Access the web interface at http://localhost:3000. The first account created automatically receives admin privileges.
⚠️ Caution: When using AI assistants like Claude or ChatGPT to generate Docker commands, always validate the image source, volume paths, and network configurations before execution. AI models may hallucinate outdated flags or insecure configurations. Cross-reference commands with official Open WebUI documentation at docs.openwebui.com before running in production environments.
Implementation
Create a docker-compose.yml file to deploy Open WebUI with persistent storage and Ollama integration:
version: '3.8'
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
ports:
- "3000:8080"
volumes:
- open-webui:/app/backend/data
environment:
- OLLAMA_BASE_URL=http://ollama:11434
- WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY}
restart: unless-stopped
depends_on:
- ollama
ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- "11434:11434"
volumes:
- ollama:/root/.ollama
restart: unless-stopped
volumes:
open-webui:
ollama:
Generate a secure secret key and launch the stack:
export WEBUI_SECRET_KEY=$(openssl rand -hex 32)
echo "WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY}" > .env
docker compose up -d
Initial Configuration
Access Open WebUI at http://localhost:3000 and create your admin account. Pull your first model through the Ollama container:
docker exec -it ollama ollama pull llama3.2:3b
docker exec -it ollama ollama pull mistral:7b
Nginx Reverse Proxy
For production deployments, configure Nginx with SSL termination:
server {
listen 443 ssl http2;
server_name ai.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/ai.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ai.yourdomain.com/privkey.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Caution: When using AI assistants like Claude or ChatGPT to generate Docker configurations, always validate volume mount paths and environment variables before deployment. AI models may hallucinate non-existent configuration options or outdated syntax that could expose your system to security risks.
Verification and Testing
After deploying Open WebUI, verify your installation is functioning correctly before connecting it to your LLM backends.
First, confirm the container is running and healthy:
docker ps --filter name=open-webui
docker logs open-webui --tail 50
Look for the startup message indicating the web server is listening on port 8080. Check resource usage to ensure the container isn’t experiencing memory pressure:
docker stats open-webui --no-stream
Web Interface Access
Navigate to http://localhost:3000 (or your configured port) and create your admin account. This first account automatically receives administrator privileges. Test the authentication flow by logging out and back in.
Backend Connectivity Test
Verify Open WebUI can reach your Ollama instance:
curl http://localhost:11434/api/tags
In the Open WebUI settings, navigate to Admin Panel → Connections and add your Ollama endpoint (http://host.docker.internal:11434 for Docker Desktop, or http://172.17.0.1:11434 for Linux). Click “Verify Connection” to test.
Model Availability
Pull a test model through Open WebUI’s interface or via Ollama directly:
ollama pull llama3.2:3b
Create a new chat and select the model from the dropdown. Send a simple prompt like “Respond with ‘OK’ if you can read this” to verify end-to-end functionality.
Performance Baseline
Run a quick inference benchmark to establish baseline performance:
time curl http://localhost:11434/api/generate -d '{
"model": "llama3.2:3b",
"prompt": "Write a haiku about Docker",
"stream": false
}'
Caution: If using AI assistants like Claude or ChatGPT to generate diagnostic commands, always review the output carefully. LLMs may hallucinate Docker flags or API endpoints that don’t exist in your specific Open WebUI version. Validate commands against official documentation before execution on production systems.
Best Practices
Run Open WebUI behind a reverse proxy like Caddy or Traefik with automatic HTTPS. Never expose port 3000 directly to the internet. Create a dedicated Docker network and use environment variables for sensitive data:
docker network create openwebui-net
docker run -d --network openwebui-net \
-e WEBUI_SECRET_KEY=$(openssl rand -hex 32) \
-e ENABLE_SIGNUP=false \
ghcr.io/open-webui/open-webui:main
Disable public signups after creating admin accounts. Store API keys in Docker secrets or HashiCorp Vault, never in plaintext environment files.
Resource Management
Monitor container resource usage with Prometheus and cAdvisor. Set memory limits to prevent OOM kills during heavy inference workloads:
services:
open-webui:
deploy:
resources:
limits:
memory: 4G
reservations:
memory: 2G
For multi-user deployments, implement rate limiting at the reverse proxy level using Traefik middleware or nginx limit_req_zone directives.
Backup Strategy
Automate daily backups of the /app/backend/data volume using restic or Borg:
docker run --rm --volumes-from open-webui \
-v /backup:/backup \
alpine tar czf /backup/openwebui-$(date +%Y%m%d).tar.gz /app/backend/data
Test restoration procedures quarterly. Store backups on separate infrastructure—NAS devices or S3-compatible storage like MinIO.
AI-Assisted Configuration
When using Claude or ChatGPT to generate Docker Compose configurations or systemd units, always validate output before deployment. AI models may hallucinate deprecated flags or incorrect volume paths. Cross-reference generated commands against official documentation. For critical infrastructure changes, test in isolated environments first.
Caution: Never blindly execute AI-suggested rm -rf commands or database migrations without manual review. AI assistants lack real-time knowledge of your specific system state and may recommend destructive operations.
FAQ
Mount a volume to /app/backend/data in your docker-compose.yml:
volumes:
- ./open-webui-data:/app/backend/data
This stores SQLite databases, uploaded files, and model configurations. Back up this directory regularly using rsync or Restic.
Can I connect Open WebUI to multiple Ollama instances?
Yes. Navigate to Settings → Connections and add multiple Ollama API endpoints:
http://192.168.1.100:11434
http://192.168.1.101:11434
Open WebUI aggregates models from all instances. Useful for load balancing across multiple GPU servers or separating coding models from general-purpose ones.
How do I enable authentication for multi-user access?
Set WEBUI_AUTH=true in your environment variables. The first user to register becomes admin. Create additional accounts through Admin Panel → Users. For SSO integration, configure OAuth2 providers like Authentik or Keycloak via OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET.
My models are slow. How do I optimize performance?
Check Ollama’s GPU utilization with nvidia-smi or rocm-smi. Increase context window in Open WebUI’s model settings, but reduce num_ctx if you’re hitting VRAM limits. For CPU inference, set OLLAMA_NUM_PARALLEL=2 to handle concurrent requests. Monitor with Prometheus using the /metrics endpoint.
Can I use Open WebUI with llama.cpp or LM Studio?
Yes. Both expose OpenAI-compatible APIs. Point Open WebUI to:
# llama.cpp server
http://localhost:8080/v1
# LM Studio
http://localhost:1234/v1
Configure in Settings → Connections → OpenAI API. Test connectivity before switching from Ollama.
Caution: When using AI assistants like Claude or ChatGPT to generate Docker commands or configuration files, always validate output before applying to production systems. AI models may hallucinate incorrect port numbers, volume paths, or security settings that could expose your deployment.