Docker: Ollama and Open WebUI together

By Emmanuel Sauvage · Published · Updated

This page may contain Amazon affiliate links. A purchase after a click can earn the site a commission, at no extra cost to you. The advice stays independent. How affiliation works.

Docker (a container engine: apps isolated in repeatable “boxes”) can start Ollama (an engine for large language models (LLMs)) and Open WebUI (a chat interface in the browser) with the same configuration on a mini PC, an x86 NAS, or a Linux PC. That is handy for a family assistant, n8n, or Home Assistant on the same host.

Docker or a native install? If you are starting out and have never run Ollama, begin with installing Ollama without Docker or the step-by-step Windows guide. There are fewer layers to debug. Come back to this page when you want a repeatable stack (the same compose.yml on two machines) or an x86 NAS. Detailed prerequisites: Ollama on a Synology NAS.

Who this is for, and how long it takes

Who Rough time Before you start
An intermediate user (Docker already installed) about 45 min Docker engine, and a sense of LAN ports
A beginner with no containers Open WebUI for beginners or native Ollama is a better start —
A household with several devices (a tablet, a mini PC left on) +15 min for LAN settings 32 GB of RAM is a good target

Method: copy the minimal version first (CPU, or add the GPU afterward), start it with docker compose up -d, pull a 7B model, then open Open WebUI. If you have an NVIDIA card on Linux, replace the file with the GPU variant before the first up. If you get stuck, the common fixes table covers 502 errors and missing models. The LAN fixes section covers access from Wi-Fi only.

How the services and ports fit together

Browser (LAN) ──► Open WebUI :8080 ──► internal HTTP ──► Ollama :11434
                         │                                    │
                    chat volume                         GGUF model volume

Caption: from a browser on the host PC, localhost:8080 is enough. From a tablet, use the mini PC’s LAN IP (http://192.168.x.x:8080). Between containers, Open WebUI calls http://ollama:11434. From inside the web container, that is not localhost.

  • 11434: the Ollama API (LAN or localhost only; leave it off the public internet).
  • 8080: the Open WebUI interface (you create an admin account on the first launch).
  • The two containers share a Docker network. Open WebUI calls http://ollama:11434, not localhost, from inside the web container.

Prerequisites

  • Docker Engine or Docker Desktop is installed.

  • Linux and an NVIDIA GPU: the NVIDIA Container Toolkit is installed on the host.

  • Windows: Docker Desktop, WSL2, and recent NVIDIA drivers if you want GPU acceleration.

  • 16 GB of RAM at a minimum, 32 GB recommended — 32 or 64 GB of RAM.

  • An x86 NAS (Synology or QNAP with Docker): check RAM and CPU before you stack Ollama and Open WebUI — Ollama on a Synology NAS.

  • An SSD for the model volumes — LLM storage.

A path without Docker: install Ollama, then Open WebUI for beginners.

Minimal compose.yml

Create a folder named stack-ia and a file named compose.yml. This block is the CPU version, or a host GPU without the NVIDIA block (about 25 lines). Paste it as written. If you are new to Compose, re-read only OLLAMA_BASE_URL, the ports, and the volumes.

services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    restart: unless-stopped
    volumes:
      - ollama_data:/root/.ollama
    ports:
      - "11434:11434"
  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
    volumes:
      - openwebui_data:/app/backend/data
    depends_on:
      - ollama
volumes:
  ollama_data:
  openwebui_data:

The named volume ollama_data keeps GGUF models (a quantized format for local inference) across restarts. NVIDIA GPU on Linux: leave this file as it is. Switch to the GPU variant (the full deploy.resources excerpt) after the NVIDIA Container Toolkit.

NVIDIA GPU variant

Replace the entire compose.yml with this block if Ollama must see the GPU inside the container (Linux, with the toolkit installed). Run this file in place of the minimal one.

services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    restart: unless-stopped
    volumes:
      - ollama_data:/root/.ollama
    ports:
      - "11434:11434"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
    volumes:
      - openwebui_data:/app/backend/data
    depends_on:
      - ollama
volumes:
  ollama_data:
  openwebui_data:

After docker compose up -d, check GPU use with docker exec -it ollama ollama ps during a generation. If the container stays on CPU, go back to the common fixes table (the GPU row).

Numbered steps after the file is in place

  1. Start: docker compose up -d
  2. Check the logs: docker compose logs -f ollama
  3. Download a model: docker exec -it ollama ollama pull mistral:7b-instruct-q4_K_M
  4. Open http://localhost:8080 (or http://YOUR_PC_IP:8080 from another device on the LAN).
  5. Create the Open WebUI administrator account on the first launch (the data stays local, in the volume).

What you should see: the Open WebUI page shows the chat screen. A model listed by ollama list answers in under a minute for a 7B Q4 when RAM is sufficient (choose a first model). If the page stays blank or shows 502, the Ollama container is not ready. See common fixes.

Security notes

  • Leave port 8080 off your router’s port-forwarding list unless you have sign-in and HTTPS.
  • Keep Ollama (11434) reachable only on the LAN or the internal Docker network.
  • Use a guest Wi-Fi network if friends connect. See privacy for local AI.

After the first chat

Hardware

This stack runs on the PC or mini PC you already have, as long as Docker and the RAM match the “who this is for” table at the top. If you are buying a dedicated machine to leave on, start with the hardware selector (Budget, Balanced, or Comfort profiles, ballpark ranges as of October 2026, with today’s price on Amazon.com), then cross-check choosing hardware for home AI and the mini PC comparison. 32 GB of RAM is the most common compromise for Ollama and Open WebUI without constant swap.

A search shortcut (October 2026, no fixed price on this page): a 32 GB mini PC on Amazon.com — an Amazon affiliate link. Check the NVMe SSD, the cooling, and the price at the time you order (how affiliation works).

Updates and backups

docker compose pull
docker compose up -d

Back up the named Compose volumes before you change machines. The commands you can copy are below. For the exact paths: docker volume inspect.

Common fixes

Symptom What to try
502 from Open WebUI The ollama container is not ready, or it crashed. Run docker compose logs ollama and wait until the pull finishes
Model missing in the UI docker exec -it ollama ollama list, then ollama pull for the missing tag
GPU unused The GPU variant is missing, or the NVIDIA Container Toolkit is missing on the Linux host
Very slow replies The model is too heavy for the RAM. See the first 7B model range

Access from a tablet or phone on Wi-Fi (firewall, LAN IP): the LAN troubleshooting section. Fix a 502 or a missing model first, with the table above.

Home integrations

Quick comparison: Ollama alone vs the Docker stack

Criterion Native Ollama install Docker Compose stack
Ease of the first launch Simpler (installer or script) Moderate (Docker and Compose)
NVIDIA GPU upkeep (Linux) Drivers on the host Host drivers and the NVIDIA Container Toolkit
Repeatability (two identical PCs) Moderate High (the same compose.yml)
Updates The Ollama installer docker compose pull, then up -d
Home automation and n8n http://IP:11434 on the host A mapped port, or the ollama:11434 network name

Where to go next

Useful environment variables (LAN)

Variable Example Use
OLLAMA_HOST 0.0.0.0:11434 Listen on the LAN (a firewall is required)
OLLAMA_ORIGINS http://192.168.1.10:8080 CORS for a custom Open WebUI address

Open these ports only if you understand privacy and how to separate the network. See the family assistant guide.

Back up the volumes (commands)

From the stack-ia folder (the one that holds your compose.yml), run docker volume ls. In the file, the key is named ollama_data. Compose prefixes the project name (often the folder name): you will see stack-ia_ollama_data, not a lone entry named ollama_data. Change -v stack-ia_ollama_data: if your prefix is different.

Linux, macOS, and Git Bash (WSL) — the /backup mount points at the current directory:

docker run --rm -v stack-ia_ollama_data:/data -v $(pwd):/backup alpine tar czf /backup/ollama_data.tgz /data

Windows PowerShell — one line, with no syntax coloring that breaks the hyphens in the volume name:

docker run --rm -v stack-ia_ollama_data:/data -v ${PWD}:/backup alpine tar czf /backup/ollama_data.tgz /data

Repeat the command with stack-ia_openwebui_data in place of stack-ia_ollama_data to save the Open WebUI history. Keep the encrypted archive on a NAS that is not exposed to the internet — a Synology NAS.

Household setups with this stack

Setup What to change
One family PC Localhost ports. Open WebUI on 127.0.0.1:8080
A tablet on Wi-Fi http://YOUR_PC_IP:8080, with no forward on the router
A mini PC in the living room Noise when it stays on plus a 7B Q4 model
A teen and code Chat through Open WebUI. If the stack is not ready yet, follow Open WebUI for beginners first, then Continue on the laptop
Voice transcription Whisper on the side, not inside this compose file

Before you stack more containers (n8n, a reverse proxy), check free RAM (32 vs 64 GB) and SSD space.

LAN troubleshooting (Open WebUI on a tablet)

A 502, or a model the chat cannot find: the same diagnosis as on the host PC — common fixes (Ollama is not ready, or the pull is missing). This table covers network access from another device only.

Symptom Check
The page will not open from the phone The Windows firewall allows port 8080 on the Private profile. Try http://YOUR_PC_IP:8080 (not the router’s IP)
Chat works on the PC, and the tablet page is blank Check the server’s LAN IP. OLLAMA_BASE_URL=http://ollama:11434 is still correct in Compose
High latency on 2.4 GHz Wi-Fi Put the mini PC server on Ethernet. Prefer a 7B Q4 model over a 13B or larger

For strictly local use with no LAN, stay on localhost. See privacy if children use the chat.

Common questions

Is Docker Desktop enough on Windows?

Yes, to get started, with WSL2 and an NVIDIA GPU set up. On Linux, the native Docker engine is usually simpler for a machine that stays on at home.

Why can't Open WebUI see Ollama?

Check that OLLAMA_BASE_URL points to http://ollama:11434 on the same Compose network.

Can I put the interface on the internet?

Leave it off the public internet unless you have strong sign-in and a proxy. Keep port 8080 on the home network or a VPN.

Can I put Whisper in the same compose.yml?

A community image can do it, and that is outside this guide. Many households install Whisper separately (offline French transcription) so the volumes stay smaller.

Does Open WebUI replace LM Studio?

They do different jobs. LM Studio (GPU offload) is mainly for trying GGUF files. Open WebUI uses the Ollama API for a family chat with more than one person.

Where are the models stored on disk?

In the Docker volume named ollama_data. Watch free space the same way you would for a native install. See SSD storage for models.

Sources

Narrow it down with the hardware selector · French version of this section