Open WebUI + Ollama Docker Compose Example
Open WebUI chat frontend wired to an Ollama backend, with persistent volumes.
The compose.yaml
name: open-webui
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
restart: unless-stopped
ports:
- 3000:8080
environment:
OLLAMA_BASE_URL: http://ollama:11434
volumes:
- webui_data:/app/backend/data
depends_on:
- ollama
logging:
driver: json-file
options:
max-size: 10m
max-file: '3'
ollama:
image: ollama/ollama:latest
restart: unless-stopped
volumes:
- ollama_data:/root/.ollama
logging:
driver: json-file
options:
max-size: 10m
max-file: '3'
volumes:
webui_data: {}
ollama_data: {}
Start it up
# Validate the configuration (does not start anything):
docker compose -f compose.yaml config
# Pull images and start in the background:
docker compose -f compose.yaml pull
docker compose -f compose.yaml up -d
# Check status and follow logs:
docker compose -f compose.yaml ps
docker compose -f compose.yaml logs -f
# Stop and remove (named volumes are kept):
docker compose -f compose.yaml down
Services
- open-webui — ghcr.io/open-webui/open-webui:main
- ollama — ollama/ollama:latest
Security notes
- warningNo healthcheckAdd a `healthcheck:` that probes a readiness endpoint or a CLI check for the service.
- warningNo healthcheckAdd a `healthcheck:` that probes a readiness endpoint or a CLI check for the service.
- warningNo memory limitSet a memory limit sized to the workload (e.g. `mem_limit: 512m`).
- warningNo memory limitSet a memory limit sized to the workload (e.g. `mem_limit: 512m`).
- warningService image uses `latest`Pin an explicit version tag (and ideally a digest) for every service image.
Open the template in the generator to apply one-click hardening.
Related templates
FAQ
How do I run this Open WebUI + Ollama Docker Compose file?
Save it as compose.yaml, then run `docker compose up -d`. Validate first with `docker compose config` and follow logs with `docker compose logs -f`.
Do I need a version field in the Open WebUI + Ollama Compose file?
No — modern Docker Compose does not require a top-level version field, and this example does not include one.
How do I customize this Open WebUI + Ollama template?
Open it in the free Docker Compose Generator to change images, ports, volumes, networks, environment variables, and health checks visually, then download your compose.yaml.
Independent educational example. "Docker" is a trademark of Docker, Inc. Review and adapt before using in production.