Ollama runs language models; Open WebUI provides the browser interface and user accounts. This guide connects two containers on a private network and keeps models and chat data in separate persistent volumes. It starts with CPU inference, without requiring a GPU.
Before you start
Follow the Docker server setup. As an OwnServa planning estimate, start with 4 CPU cores, 8 GB RAM and at least 20 GB of free SSD storage for a small-model trial. This is not enough for every model: model weights, context length and concurrent requests determine RAM/VRAM usage. CPU responses can be slow. Larger models may need substantially more memory and GPU capacity.
Use loopback port 3000 if available, or change the host-side port and proxy together. Your Open WebUI account is local to this installation; you do not need an OwnServa or external AI-provider account to chat with a downloaded Ollama model.
mkdir -p ~/selfhosted/local-ai
cd ~/selfhosted/local-ai
umask 077
openssl rand -hex 32
Save the generated value in .env:
WEBUI_SECRET_KEY=REPLACE_WITH_RANDOM_HEX_SECRET
Configure the database and model storage
Save as compose.yaml:
services:
ollama:
image: ollama/ollama:latest
restart: unless-stopped
volumes:
- models:/root/.ollama
webui:
image: ghcr.io/open-webui/open-webui:main
restart: unless-stopped
ports:
- "127.0.0.1:3000:8080"
environment:
OLLAMA_BASE_URL: http://ollama:11434
WEBUI_SECRET_KEY: ${WEBUI_SECRET_KEY:?set WEBUI_SECRET_KEY}
volumes:
- chats:/app/backend/data
depends_on:
- ollama
volumes:
models:
chats:
Open WebUI initializes its default SQLite database in the chats volume. No separate SQL service or manual database user is needed. The models volume holds downloaded model files. The persistent secret key protects application secrets and should stay stable across container replacements.
The Ollama API has no host port here. Open WebUI reaches it by service name. Do not expose an unauthenticated model API to the internet. Before production use, select supported release tags or digests instead of leaving these moving tags unreviewed.
Start and download a model
chmod 600 .env
sudo docker compose config --quiet
sudo docker compose up -d
sudo docker compose ps
sudo docker compose logs --tail=80 webui ollama
sudo docker compose exec ollama ollama pull llama3.2:1b
sudo docker compose exec ollama ollama list
The model download needs outbound internet access and free disk space. llama3.2:1b is a small example, not a recommendation for every task; review its license and suitability. For NVIDIA acceleration, install and test the NVIDIA Container Toolkit and use the GPU settings in Ollama's Docker documentation. This Compose example is intentionally CPU-only.
Create the first administrator and sign in
From your computer, open a tunnel:
ssh -L 3000:127.0.0.1:3000 your-user@YOUR_SERVER_IP
Open http://localhost:3000. Wait for startup, choose Get started, then create the first administrator with your name, email and a strong password. The first account becomes administrator. Review sign-up controls before inviting anyone else; current releases turn off new sign-ups after the initial admin is created.
Sign in, start a new chat and choose llama3.2:1b in the model selector. Send a short prompt and wait for a response. If the list is empty, check the Ollama connection in the admin connection settings: it should be http://ollama:11434 for this Compose network, not localhost inside the WebUI container.
To access it without the tunnel, proxy an HTTPS domain such as ai.example.com to 127.0.0.1:3000 using the HTTPS guide. Keep authentication enabled. Review external providers, plugins and tools before enabling them, since they can change where data goes and what the system can execute.
Back up and maintain
Preserve the chats volume and WEBUI_SECRET_KEY. Back up SQLite consistently, such as during a stopped-container maintenance window. Model files can be downloaded again, but keeping custom model definitions and the resolved image/model versions makes recovery easier. Confirm restoration on a separate instance.
Troubleshooting
- No models: check
ollama list, the admin connection URL and model download logs. - Very slow replies: try a smaller model and context size; check available RAM and CPU.
- Chat streams stop through HTTPS: confirm the reverse proxy supports WebSockets and appropriate timeouts.
- An empty setup screen returns: check the persistent
chatsvolume before creating another account.
Official references
Read Open WebUI's quick start, hardening guide, environment settings and Ollama Docker setup.
Written by OwnServa. Check the official release notes before updating, keep independent backups and test a restore before relying on your installation.