Open WebUI with Ollama packs a ChatGPT-style AI assistant that runs open models on your own server into a single container. This guide covers a Docker Compose deployment for small production use: the app listens only on localhost, Caddy serves it over HTTPS, and the data lives in volumes you can back up.
Key points on deploying Open WebUI with Ollama in 30 seconds
- The
open-webui:ollamaimage bundles the web interface and Ollama in one container. - About 8 GB of RAM runs 3B to 8B parameter models without a GPU.
- The port is published only on 127.0.0.1 and outside access goes through Caddy with HTTPS.
- The first registered user becomes admin, so create yours right after startup.
- Back up the
datavolume; models can be downloaded again.
An earlier article walked through what Open WebUI does. This one focuses on getting it running properly. As noticias.ai notes in its guide to building a private ChatGPT (in Spanish), security is not optional: Open WebUI and Ollama are among the targets of an AI agent campaign that hunts for exposed installs to steal model provider keys.
Requirements and Docker Compose deployment
You need a Linux server with Docker and the Compose plugin; Ubuntu or Debian are the easiest. With 8 GB of RAM, 3B to 8B models run at a usable speed on CPU alone; larger models need a GPU or much more memory. On disk, the image takes a few GB and each model adds 2 to 5 GB. For outside access, point a DNS record such as chat.example.com at the server.
First, generate the key that signs sessions:
openssl rand -hex 32
Then create docker-compose.yml in its own directory, for example /opt/open-webui:
services:
open-webui:
image: ghcr.io/open-webui/open-webui:ollama
restart: unless-stopped
environment:
WEBUI_SECRET_KEY: paste-the-generated-key-here
OLLAMA_BASE_URL: http://localhost:11434
ports:
- "127.0.0.1:3080:8080"
volumes:
- ollama:/root/.ollama
- data:/app/backend/data
volumes:
ollama:
data:Code language: JavaScript (javascript)
cd /opt/open-webui
docker compose up -d
docker compose logs -f
The container listens on 8080 internally. Publishing it as 127.0.0.1:3080 keeps the app unreachable from outside even if the firewall is open. OLLAMA_BASE_URL points to the Ollama inside the same container; without it, Open WebUI looks for a separate ollama container. Check it with curl -I http://127.0.0.1:3080 before moving on.
HTTPS with Caddy and first login
Caddy obtains and renews the certificate automatically. With Caddy installed on the host, this block in /etc/caddy/Caddyfile is enough:
chat.example.com {
reverse_proxy 127.0.0.1:3080
}
sudo systemctl reload caddy
sudo ufw allow 80,443/tcp
Then open https://chat.example.com and create your own account immediately, because the first one registered becomes admin. In the admin settings, decide whether new users can sign up freely or must wait for approval. Next, pull a model from the model picker; for CPU, llama3.2:3b, qwen3:4b or gemma3:4b are sensible choices. Under the admin connections you can add OpenAI-compatible APIs, whose models show up in the same picker.
Updates and backups
To update, pull the new image and recreate the container; users, chats and models persist in the volumes:
docker compose pull
docker compose up -d
docker image prune -f
The critical volume is data, which holds users and conversations. Compose prefixes volume names with the project name (the directory name by default), so confirm the real name with docker volume ls first. With the service stopped, so the database is not copied mid-write, a simple backup looks like this:
docker compose stop
docker run --rm -v open-webui_data:/data -v /opt/backups:/backup alpine tar czf /backup/open-webui-data.tar.gz -C /data .
docker compose startCode language: JavaScript (javascript)
The ollama volume stores the models and backing it up is optional, since they can be downloaded again. If you have added external provider keys, restrict who can reach the admin panel and keep an eye on usage in those accounts.
FAQ
Why publish the port only on 127.0.0.1?
So the app is not exposed directly to the internet and all outside traffic goes through the HTTPS reverse proxy.
Which volume should I back up?
The data volume, which holds users and conversations. The ollama volume stores models that can be downloaded again.
How do I update Open WebUI?
Run docker compose pull and docker compose up -d; your data stays in the volumes.
Sources:
