When to use this stack
Ollama downloads open-weight language models and serves them through a local HTTP API. Open WebUI is a browser chat interface that talks to that API and adds users, chat history, model selection and document features. Together they give you a private AI chat that runs on your own hardware, with no per-token billing. This stack pins Ollama 0.13.5 and Open WebUI v0.6.40, keeps the Ollama API inside the Docker network so only Open WebUI can reach it, and binds the web interface to 127.0.0.1 so you can place a reverse proxy in front of it.
Use this stack when you want a private assistant for notes or code on a machine with enough RAM, or when you want to try several models side by side before deciding which one to use in a product. Do not use it when you need the largest frontier models, because a home server or small VPS will not run them at a useful speed. Do not use it on a public server without authentication and HTTPS, because Open WebUI is a full application with user accounts and anyone who reaches the login page can attempt to sign up. CPU-only inference is slow for models above roughly 8 billion parameters; a GPU makes a large difference, and the Variations section explains how to add one.
docker-compose.yml
services:
ollama:
image: ollama/ollama:0.13.5
restart: unless-stopped
volumes:
- ollama_data:/root/.ollama
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 30s
timeout: 10s
retries: 5
start_period: 20s
open-webui:
image: ghcr.io/open-webui/open-webui:v0.6.40
restart: unless-stopped
depends_on:
ollama:
condition: service_healthy
environment:
OLLAMA_BASE_URL: http://ollama:11434
WEBUI_SECRET_KEY: ${WEBUI_SECRET_KEY}
ports:
- "127.0.0.1:3000:8080"
volumes:
- open_webui_data:/app/backend/data
volumes:
ollama_data:
open_webui_data:WEBUI_SECRET_KEY=CHANGE_ME_RANDOM_64_CHARACTER_SECRET.env
WEBUI_SECRET_KEY=CHANGE_ME_RANDOM_64_CHARACTER_SECRETStart and verify
# 1. Generate the secret key and paste it into WEBUI_SECRET_KEY
openssl rand -hex 32
# 2. Validate the compose file
docker compose config --quiet
# 3. Start both services
docker compose up -d
# 4. ollama should show "(healthy)" once its API answers
docker compose ps
# 5. Download a small model into the ollama_data volume (a few GB, takes a while)
docker compose exec ollama ollama pull llama3.2
# 6. List the models Ollama has available
docker compose exec ollama ollama list
# 7. Health check of Open WebUI through the loopback port (expected: a small JSON response)
curl -fsS http://127.0.0.1:3000/healthOpen http://127.0.0.1:3000 in a browser. The first account you create becomes the administrator, so create it yourself right after the first start.
Production checklist
- Set WEBUI_SECRET_KEY to a long random value and keep it stable, because changing it signs out all users.
- Keep port 11434 unpublished. Only the Open WebUI container should talk to Ollama.
- Place Open WebUI behind a reverse proxy with HTTPS, and keep the port bound to 127.0.0.1 so it is not reachable directly.
- Disable new sign-ups in the administrator settings once your users have accounts.
- Back up the open_webui_data volume, because it holds accounts, chats and uploaded documents.
- Watch disk space. Each model takes gigabytes, and old models stay in ollama_data until you remove them with ollama rm.
- Pin both image tags and upgrade after reading the release notes of each project.
- Check memory use with docker stats while a model is answering, and choose a smaller model if the host starts swapping.
Common problems
- Symptom: Open WebUI shows no models in the selector. Cause: no model has been pulled, or OLLAMA_BASE_URL does not point to the ollama service. Fix: run the pull command in the Start section and confirm the variable is http://ollama:11434.
- Symptom: the container stops during a long answer and the log mentions an out-of-memory kill. Cause: the model needs more memory than the host or container can provide. Fix: choose a smaller model or a more heavily quantized variant, and close other memory-hungry services.
- Symptom: models download again after every restart. Cause: the volume for /root/.ollama is missing or was removed with docker compose down -v. Fix: keep the ollama_data volume and avoid the -v flag unless you intend to delete the data.
- Symptom: the Open WebUI login page loads but the health check fails right after the first start. Cause: the application is still running database migrations. Fix: wait a minute and check docker compose logs open-webui before changing the configuration.
- Symptom: a stranger created an administrator account. Cause: the interface was reachable from the network before the first account was created. Fix: keep the loopback binding, create the administrator immediately after the first start, and delete unknown accounts from the admin panel.
Variations
- NVIDIA GPU: install the NVIDIA Container Toolkit on the host, then add a GPU device reservation to the ollama service using the deploy.resources.reservations.devices syntax from the Docker documentation. Ollama then loads models onto the GPU automatically.
- Ollama on another machine: remove the ollama service and set OLLAMA_BASE_URL to the address of the other machine, for example http://192.168.1.50:11434. Make sure that machine does not expose port 11434 to the internet.
- Reverse proxy with HTTPS: add Caddy or nginx on the same Docker network and proxy your domain to open-webui:8080. Remove the loopback port mapping if the proxy is the only entry point.
Questions
How much RAM do I need?
A quantized 7B or 8B model usually needs about 6 to 8 GB of free memory on a CPU-only machine, so plan for at least 8 GB of RAM. Smaller models run on less, and larger ones need a GPU or much more memory.
Do my chats leave my server?
Not with this stack. Ollama runs the models locally and Open WebUI stores users and chats in its own volume. External services only receive data if you configure one, for example a remote API provider in the settings.
Why does Open WebUI show no models?
Usually no model has been pulled yet. Run docker compose exec ollama ollama pull llama3.2 and refresh the page. If models still do not appear, check that OLLAMA_BASE_URL points to http://ollama:11434.
Adapt this stack
Load these files into the builder to rename services, change ports, add a cache or a proxy, and generate fresh passwords for the .env.
Open in builderRelated stacks
Home Assistant Smart Home Hub
Run Home Assistant 2026.10 in Docker Compose with a pinned image, persistent config volume, timezone setup and reverse proxy notes for secure remote access.
n8n Workflow Automation with PostgreSQL
Self-host n8n 2.48 with PostgreSQL 16 in Docker Compose: encrypted credentials, database healthcheck, loopback-only port and a production checklist.
Nextcloud + MariaDB + Redis File Sync
Self-host Nextcloud with MariaDB 11.4 and Redis in Docker Compose. Pinned tags, database healthcheck, memory cache and the production steps for HTTPS and cron.
Paperless-ngx with PostgreSQL and Redis
Run Paperless-ngx 2.20 document archive with PostgreSQL 16 and Redis in Docker Compose. OCR language setup, loopback-only port, backups and a consume folder.
Browse more Automation, AI & Self-Hosted stacks or the full library.