Open WebUI is the chat interface; Ollama is the engine. Docker Compose runs both as containers that talk to each other over a private network, so you get a ChatGPT-style page on your own machine without installing either directly. The Compose file below follows the layouts in the linked guides — with one deliberate change: Ollama’s port is not published to the host, because Ollama has no login and must not be reachable from outside.
Related guide: How to Run Ollama in a Docker Container
Write the Compose file
services:
ollama:
image: ollama/ollama
volumes:
- ollama_data:/root/.ollama
restart: unless-stopped
open-webui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "127.0.0.1:3000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
- WEBUI_SECRET_KEY=REPLACE_WITH_A_LONG_RANDOM_STRING
volumes:
- open-webui_data:/app/backend/data
depends_on:
- ollama
restart: unless-stopped
volumes:
ollama_data:
open-webui_data:
Two details matter. First, Open WebUI reaches Ollama as http://ollama:11434 — the service name, not localhost, because inside a container localhost means the container itself. Second, generate the secret key yourself (for example with openssl rand -hex 32) and set WEBUI_SECRET_KEY: the guides warn that the key can silently change when the container is recreated if you let Open WebUI generate it. Pin a release tag instead of main once you know the setup works, so upgrades happen when you decide.
Start it and pull a model
docker compose up -d
docker compose exec ollama ollama pull llama3.2
docker compose exec ollama ollama ps
Open http://localhost:3000 and create the first account — it becomes the administrator, so do this before anyone else can reach the page. Then pick the model from the dropdown and start chatting. If the model list is empty, the two containers are not talking: check that OLLAMA_BASE_URL is http://ollama:11434 and that Ollama is running inside its container.
Expected result. We checked the linked Open WebUI guides for the Compose layouts, the OLLAMA_BASE_URL setting, the secret key warning, and the first-account-becomes-admin rule. We did not run this software ourselves for this guide, so no output here is a recorded result; steps marked UNTESTED were checked against the sources below, not run.
Limits
Ollama has no login, so do not publish its port to the host or the internet — the Compose file above deliberately leaves it unpublished. The first account created becomes the administrator, so create it immediately after starting the stack. The Compose file here is assembled from the guides and is UNTESTED on this machine; run docker compose up -d and check both containers are healthy before relying on it.
Sources
- Open WebUI multi-user setup — Compose file with ollama and open-webui services, OLLAMA_BASE_URL=http://ollama:11434, ENABLE_SIGNUP and DEFAULT_USER_ROLE=pending; docker compose up -d
- Open WebUI on a home server — deploy with Compose, pin a release tag, set WEBUI_SECRET_KEY yourself; the first person to reach the sign-up page becomes the administrator
- Self-host a private ChatGPT with Open WebUI and Ollama — Compose layout with ollama and open-webui services; docker compose exec ollama ollama pull llama3.2; the first account created becomes the administrator
Checked 2026-11-28.
