Ollama and Open WebUI with Docker Compose (GPU or CPU)

Guide · Local AI · Last updated · How we research

On this page
  1. What you are installing
  2. Before you start
  3. Path A — Official: Ollama on the host, Open WebUI in Compose
  4. Path B — Optional combined Compose file
  5. All-in-one official alternative
  6. Updates
  7. Backups
  8. Common errors
  9. Check that a model is on the GPU
  10. Sources

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 tags ollama/ollama and ghcr.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

  1. Start Ollama with the official docker run for CPU or NVIDIA (port 11434, volume ollama:/root/.ollama).
  2. Start Open WebUI with the official Compose file (host port 3000 maps to container port 8080, volume open-webui:/app/backend/data, WEBUI_SECRET_KEY set once).
  3. If Ollama is already on the host, Open WebUI reaches it at http://host.docker.internal:11434. If both services share a Compose file, set OLLAMA_BASE_URL=http://ollama:11434.
  4. Open http://<MACHINE_IP>:3000. In the logs, wait for Application startup complete.
  5. 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'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

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):

bash
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

To 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:

bash
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/ollama

AMD GPU (official rocm tag):

bash
docker run -d --device /dev/kfd --device /dev/dri -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocm

Ollama 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:

bash
docker exec -it ollama ollama run llama3.2

llama3.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:

yaml
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.

yaml
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:

bash
docker compose up -d

Pull 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:

bash
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:ollama

CPU 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.

bash
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 it

To 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.

bash
docker pull ollama/ollama:0.40.16
docker rm -f ollama
# then the same official docker run, or docker compose up -d

Ollama on the host (Linux install script): the official update is to run the install script again:

bash
curl -fsSL https://ollama.com/install.sh | sh

The Linux docs also document pinning with OLLAMA_VERSION (their example is 0.5.7). For the release checked here:

bash
curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION=0.40.16 sh

Confirm 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:

bash
docker run --rm -v open-webui:/data -v $(pwd):/backup \
  alpine tar czf /backup/openwebui-$(date +%Y%m%d).tar.gz /data

Official restore (this deletes everything in the volume before extracting; their docs call that out):

bash
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-webui

Replace 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 messageWhat the official docs say to do
UI never loads; logs never show Application startup completeWait for that line, or see Open WebUI's Startup & Docker Failures.
Port 3000 already takenChange the left number in -p 3000:8080 or "3000:8080".
Open WebUI cannot reach Ollama; Ollama is only listening on 127.0.0.1Set 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 recreateWEBUI_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 installOfficial 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 hostConfirm 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 macOSOllama'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

bash
docker exec ollama ollama ps

The 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

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.

Related guides