Ollama and Open WebUI with Docker Compose (GPU or CPU)
On this page
Pinned versions: Ollama v0.40.16 (GitHub release, published 2026-11-10 03:21 JST / 2026-11-09 18:21 UTC — https://github.com/ollama/ollama/releases/tag/v0.40.16; Docker Hub tag
ollama/ollama:0.40.16, last updated 2026-11-09 23:23 UTC). Open WebUI v0.13.3 (GitHub release, published 2026-11-09 08:48 JST / 2026-11-08 23:48 UTC — https://github.com/open-webui/open-webui/releases/tag/v0.13.3). Official docs also document the rolling tagsollama/ollamaandghcr.io/open-webui/open-webui:main. Last checked: 2026-11-12.
This guide runs Ollama as the model server and Open WebUI as the chat UI, with Docker. It covers a CPU-only host and an NVIDIA GPU host, then updates, volume backups and the errors Open WebUI and Ollama document for this setup.
Quick answer
- Start Ollama with the official
docker runfor CPU or NVIDIA (port 11434, volumeollama:/root/.ollama).- Start Open WebUI with the official Compose file (host port 3000 maps to container port 8080, volume
open-webui:/app/backend/data,WEBUI_SECRET_KEYset once).- If Ollama is already on the host, Open WebUI reaches it at
http://host.docker.internal:11434. If both services share a Compose file, setOLLAMA_BASE_URL=http://ollama:11434.- Open
http://<MACHINE_IP>:3000. In the logs, wait forApplication startup complete.- Back up both Docker volumes before every update. Lab Lifeboat can turn that into a printable restore plan.
To size models against VRAM and RAM, use the local LLM hardware calculator. For a desktop app instead of Docker, see Ollama vs LM Studio. All three pages are listed on Local AI.
What you are installing
- Ollama serves local models and exposes an API on port 11434. The official Docker image is
ollama/ollama. Models and data live in the volume mounted at/root/.ollama. - Open WebUI is the browser UI. The official image is
ghcr.io/open-webui/open-webui. Chats, users and settings live in the volume mounted at/app/backend/data. The official quick start maps host port 3000 to container port 8080.
Ollama's Docker page documents docker run, not Compose. Open WebUI's quick start documents both docker run and a Compose file for the UI, talking to Ollama on the host via host.docker.internal. The combined Compose file later in this guide is those official flags written as two services, with OLLAMA_BASE_URL pointed at the Compose service name.
Before you start
- Docker Engine with the Compose v2 plugin (
docker composewith a space, notdocker-compose). Open WebUI's docs warn that older tutorials may still show Compose v1 syntax. - For NVIDIA GPU acceleration in the Ollama container: the NVIDIA Container Toolkit, which Ollama's Docker docs also walk through, then
sudo nvidia-ctk runtime configure --runtime=dockerandsudo systemctl restart docker. Ollama's FAQ says GPU acceleration in Docker works on Linux or Windows with WSL2, and is not available for Docker Desktop on macOS (no GPU passthrough). - Ollama's hardware support page: NVIDIA GPUs need compute capability 5.0+ and driver 550 or newer; compute capability 5.0 through 6.2 needs driver 570 or newer.
- Disk space for models. Official Ollama library sizes (checked 2026-11-12) include
llama3.2:3bat 2.0GB andllama3.1:8bat 4.9GB. Larger tags are in the hardware guide. - Generate a secret key and keep it:
openssl rand -hex 32. Open WebUI requiresWEBUI_SECRET_KEY. Its docs say that without a fixed key, every recreated container logs everyone out.
On a typical Intel N100 mini PC there is no NVIDIA GPU for this stack, so use the CPU-only path. See N100 vs N150 and N100 vs N305 vs ThinkCentre Tiny. If Ollama will run in a Proxmox VM and you want the NVIDIA or official AMD path, the GPU has to be visible to Docker inside that VM. That is PCI(e) passthrough on Proxmox. A first install is covered in Proxmox on a mini PC.
Path A — Official: Ollama on the host, Open WebUI in Compose
This is the layout Open WebUI's quick start describes.
1. Start Ollama
CPU only (docs.ollama.com/docker):
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollamaTo pin the image checked on 2026-11-12, use ollama/ollama:0.40.16 in place of ollama/ollama.
NVIDIA GPU: install the NVIDIA Container Toolkit, then:
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollamaAMD GPU (official rocm tag):
docker run -d --device /dev/kfd --device /dev/dri -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocmOllama also documents Vulkan support in the default ollama/ollama image, enabled when the container can access the GPU devices, with OLLAMA_VULKAN=0 to disable it.
Pull a first model:
docker exec -it ollama ollama run llama3.2llama3.2 is the default tag on the library page, 2.0GB, 128K context (checked 2026-11-12).
Ollama binds 127.0.0.1:11434 by default on a host install. That is enough for Open WebUI on the same machine via host.docker.internal. To listen on all interfaces (for example so another host can reach it), the FAQ says to set OLLAMA_HOST=0.0.0.0:11434.
2. Official Open WebUI Compose file
Save this as docker-compose.yml. It is the official file from Open WebUI's quick start. Replace your-secret-key with the output of openssl rand -hex 32, then run docker compose up -d:
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "3000:8080"
volumes:
- open-webui:/app/backend/data
extra_hosts:
- host.docker.internal:host-gateway
environment:
- WEBUI_SECRET_KEY=your-secret-key
restart: unless-stopped
volumes:
open-webui:To pin the release checked on 2026-11-12, change the image line to ghcr.io/open-webui/open-webui:v0.13.3. Open WebUI's docs document both :main (a rolling tag; :latest is the same rolling image) and :vX.Y.Z.
The docs state that extra_hosts makes host.docker.internal resolve on Linux, and that with no OLLAMA_BASE_URL set, the image looks for Ollama at http://host.docker.internal:11434 (then :12434).
Open http://<MACHINE_IP>:3000. If nothing loads, run docker compose logs -f and wait for Application startup complete. If port 3000 is taken, change the left number in "3000:8080".
The official docs also note: if you add container_name: open-webui, update and backup commands that target a container named open-webui keep working. Without it, Compose names the container <project>-open-webui-1.
Path B — Optional combined Compose file
Use this when you want Ollama and Open WebUI in one file. The Open WebUI service follows the official Compose file, with the image pinned and OLLAMA_BASE_URL=http://ollama:11434 because Ollama is a sibling service on the Compose network, not a process on the host. The Ollama service is the official docker run flags written as Compose. The deploy.resources GPU block below is the snippet Open WebUI documents for Compose GPU access, applied to Ollama as the Compose equivalent of Ollama's official --gpus=all flag.
services:
ollama:
image: ollama/ollama:0.40.16
container_name: ollama
ports:
- "11434:11434"
volumes:
- ollama:/root/.ollama
restart: unless-stopped
# NVIDIA: uncomment after installing the NVIDIA Container Toolkit
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
# capabilities: [gpu]
# AMD: use image ollama/ollama:rocm and:
# devices:
# - /dev/kfd
# - /dev/dri
open-webui:
image: ghcr.io/open-webui/open-webui:v0.13.3
container_name: open-webui
ports:
- "3000:8080"
volumes:
- open-webui:/app/backend/data
environment:
- WEBUI_SECRET_KEY=your-secret-key
- OLLAMA_BASE_URL=http://ollama:11434
restart: unless-stopped
depends_on:
- ollama
volumes:
ollama:
open-webui:depends_on only controls start order; it does not wait until Ollama is ready. Replace your-secret-key with a saved openssl rand -hex 32 value, then:
docker compose up -dPull a model with docker exec -it ollama ollama run llama3.2.
All-in-one official alternative
Open WebUI also publishes ghcr.io/open-webui/open-webui:ollama, which bundles Ollama in the same container. Official commands:
NVIDIA:
docker run -d -p 3000:8080 --gpus=all -v ollama:/root/.ollama -v open-webui:/app/backend/data -e WEBUI_SECRET_KEY=your-secret-key --name open-webui --restart always ghcr.io/open-webui/open-webui:ollamaCPU only (same command without --gpus=all).
The :cuda tag is different: Open WebUI's docs say it moves Open WebUI's own local models (embedding, reranking and Whisper) to the GPU. Ollama's models use a GPU only if the Ollama container has one.
Updates
Open WebUI, official Compose: docker compose pull and then docker compose up -d. The volume is kept. The docs recommend backing up before every update.
**Open WebUI, official docker run:** remove the container (the open-webui volume stays), pull, and recreate with the same flags, including the same WEBUI_SECRET_KEY.
docker rm -f open-webui
docker pull ghcr.io/open-webui/open-webui:v0.13.3
# then the same docker run (or compose up) as when you installed itTo follow the rolling tag instead, pull ghcr.io/open-webui/open-webui:main.
Ollama Docker: pull the new image and recreate the ollama container with the same volume and flags. The ollama volume keeps the models.
docker pull ollama/ollama:0.40.16
docker rm -f ollama
# then the same official docker run, or docker compose up -dOllama on the host (Linux install script): the official update is to run the install script again:
curl -fsSL https://ollama.com/install.sh | shThe Linux docs also document pinning with OLLAMA_VERSION (their example is 0.5.7). For the release checked here:
curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION=0.40.16 shConfirm what is running with docker exec ollama ollama --version or, on a host install, ollama --version.
Backups
Open WebUI's update docs: all data lives in the open-webui volume (database, uploaded files, generated content). Back up before every update, and on a regular schedule.
Official backup:
docker run --rm -v open-webui:/data -v $(pwd):/backup \
alpine tar czf /backup/openwebui-$(date +%Y%m%d).tar.gz /dataOfficial restore (this deletes everything in the volume before extracting; their docs call that out):
docker stop open-webui
docker run --rm -v open-webui:/data -v $(pwd):/backup \
alpine sh -c "rm -rf /data/* && tar xzf /backup/openwebui-YYYYMMDD.tar.gz -C /"
docker start open-webuiReplace YYYYMMDD with the backup file's date.
Ollama does not publish a matching one-liner, but the models live in the ollama volume at /root/.ollama. The same volume-tar pattern works if you change the volume name and the archive name, for example /backup/ollama-$(date +%Y%m%d).tar.gz. Keep both archives together. Lab Lifeboat will help you write down where those files live and the restore order.
Do not run docker compose down -v unless you intend to delete the volumes. Open WebUI's uninstall docs state that docker compose down -v deletes persistent data.
Common errors
| Symptom or message | What the official docs say to do |
|---|---|
UI never loads; logs never show Application startup complete | Wait for that line, or see Open WebUI's Startup & Docker Failures. |
| Port 3000 already taken | Change the left number in -p 3000:8080 or "3000:8080". |
| Open WebUI cannot reach Ollama; Ollama is only listening on 127.0.0.1 | Set OLLAMA_HOST=0.0.0.0 (or 0.0.0.0:11434), in the systemd unit, Docker flags or shell, then restart Ollama. |
| Docker Connection Error (UI in Docker, Ollama on the host) | Official alternative: docker run -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main. After that, the UI is at http://localhost:8080 (host networking uses the container port). The host.docker.internal path in Path A is the default official layout. |
Chats fail with Model not found for a model that worked a moment ago; the model list empties; logs show ClientConnectorDNSError or Cannot connect to host ... | Open WebUI documents this as intermittent name lookup, sometimes mis-reported as "Model not found". Leave the optional c-ares resolver off unless you have a reason to set AIOHTTP_CLIENT_ASYNC_DNS_RESOLVER=true. |
Model selector spins; 500 Internal Server Error on /api/models; logs show Connection error: Cannot connect to host... | An unreachable Ollama or OpenAI base URL is configured. The default wait is 10 seconds per endpoint. Fix or remove the bad URL under Settings > Admin > Connections, or temporarily set RESET_CONFIG_ON_START=true if the bad URL is stored in the database and you cannot open Settings. You can also lower AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST (the docs show 3 as an example). |
| Everyone is logged out after a recreate | WEBUI_SECRET_KEY was not fixed. Set it once and keep it. |
WEBUI_SECRET_KEY is not set. It is a hard requirement when authentication is enabled. | Official Windows start-script message when .webui_secret_key is empty. Delete the empty file or set the variable yourself. |
ValueError: No embedding model is loaded with offline mode on a fresh install | Official fix: boot once without OFFLINE_MODE / HF_HUB_OFFLINE so the embedding model can cache, or set RAG_EMBEDDING_ENGINE to ollama, openai or azure_openai. |
| GPU not used in Docker on a Linux/NVIDIA host | Confirm the NVIDIA Container Toolkit and nvidia-ctk runtime configure --runtime=docker. Then check docker exec ollama ollama ps. The official FAQ: 100% GPU means the model is entirely in GPU memory; 100% CPU means system memory; a split such as 48%/52% CPU/GPU means both. |
| GPU in Docker Desktop on macOS | Ollama's FAQ: not available, because of the lack of GPU passthrough and emulation. |
Ollama logs on a host install: cat ~/.ollama/logs/server.log or journalctl -u ollama --no-pager --follow --pager-end. For the Docker container: docker logs ollama.
Check that a model is on the GPU
docker exec ollama ollama psThe official columns include SIZE, PROCESSOR and, on current releases, CONTEXT. SIZE includes more than the on-disk weight file. For context-length recommendations by VRAM, see the hardware guide.
Sources
- Ollama v0.40.16: https://github.com/ollama/ollama/releases/tag/v0.40.16 (checked 2026-11-12)
- Docker Hub
ollama/ollama:0.40.16: https://hub.docker.com/r/ollama/ollama/tags (checked 2026-11-12) - Ollama Docker: https://docs.ollama.com/docker (checked 2026-11-12)
- Ollama FAQ (bind address,
ollama ps, Docker GPU, macOS Docker Desktop): https://docs.ollama.com/faq (checked 2026-11-12) - Ollama hardware support: https://docs.ollama.com/gpu (checked 2026-11-12)
- Ollama context length: https://docs.ollama.com/context-length (checked 2026-11-12)
- Ollama Linux install and updates: https://docs.ollama.com/linux (checked 2026-11-12)
- Open WebUI v0.13.3: https://github.com/open-webui/open-webui/releases/tag/v0.13.3 (checked 2026-11-12)
- Open WebUI quick start (Docker, Compose, tags, ports): https://docs.openwebui.com/getting-started/quick-start/ (checked 2026-11-12)
- Open WebUI updating and volume backup: https://docs.openwebui.com/getting-started/updating/ (checked 2026-11-12)
- Open WebUI connection errors: https://docs.openwebui.com/troubleshooting/connection-error (checked 2026-11-12)
- Open WebUI startup failures: https://docs.openwebui.com/troubleshooting/startup (checked 2026-11-12)
- llama3.2 library size: https://ollama.com/library/llama3.2 (checked 2026-11-12)
Plan your restore before you need it: Lab Lifeboat is our free offline tool that turns your setup into a printable recovery runbook. It stores no passwords and sends nothing.

