Blog/Local AI

Ollama + Open WebUI Docker Setup (2026): Install, Connect and Fix Errors

This guide builds a two-container local AI stack: Ollama runs the model API and Open WebUI provides the browser interface. It uses the connection names and commands in the official Ollama and Open WebUI documentation, then adds a repeatable verification and troubleshooting checklist.

Privacy boundary: Ollama says prompts and responses from locally run models are not sent to ollama.com. Cloud models and web search are online features. To enforce local-only operation, disable Ollama cloud features as shown below and review every Open WebUI integration separately.

Before you start

Docker Compose file

Create a new directory and save this as compose.yaml. The services share a private Compose network, so Open WebUI can reach Ollama by the service name ollama.

services:
  ollama:
    image: ollama/ollama
    container_name: ollama
    restart: unless-stopped
    ports:
      - "127.0.0.1:11434:11434"
    volumes:
      - ollama-data:/root/.ollama

  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    restart: unless-stopped
    ports:
      - "127.0.0.1:3000:8080"
    volumes:
      - open-webui-data:/app/backend/data
    environment:
      OLLAMA_BASE_URL: http://ollama:11434
    depends_on:
      - ollama

volumes:
  ollama-data:
  open-webui-data:

For a production-like deployment, replace the floating Open WebUI :main tag with a tested release tag from the official release notes. Keep both data volumes in your backup plan.

Start and verify the stack

docker compose pull
docker compose up -d
docker compose ps
curl http://127.0.0.1:11434/api/tags

Open http://localhost:3000. Create the first administrator account. Before making the interface reachable by other users, review signup settings, use a persistent secret, add TLS and restrict network access.

Download and run a local model

The official Ollama quickstart uses gemma3 as an example. You can substitute any current tag from the official model library that fits your hardware.

docker exec -it ollama ollama run gemma3

# List downloaded models
docker exec -it ollama ollama list

# Confirm the HTTP chat API
curl http://127.0.0.1:11434/api/chat -d '{
  "model": "gemma3",
  "messages": [{"role": "user", "content": "Reply with: stack works"}],
  "stream": false
}'

After the model appears in ollama list, refresh Open WebUI. If it does not appear, test the network path from inside the WebUI container:

docker exec open-webui   curl -fsS http://ollama:11434/api/tags

NVIDIA GPU Compose addition

After installing and configuring the NVIDIA Container Toolkit, add this block to the ollama service:

    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

Recreate the container, then inspect the logs. GPU availability should be proven from runtime output, not assumed from model speed alone.

docker compose up -d --force-recreate ollama
docker compose logs --tail=200 ollama

Force Ollama into local-only mode

Ollama documents two equivalent controls. Add the environment variable to the ollama service:

    environment:
      OLLAMA_NO_CLOUD: "1"

Or create ~/.ollama/server.json in a native installation:

{
  "disable_ollama_cloud": true
}

Restart Ollama and check its logs for confirmation. This disables Ollama cloud models and web search; it does not automatically disable third-party Open WebUI tools or providers.

Common connection errors

SymptomLikely causeCheck
No models in Open WebUIWrong Ollama URL or no model downloadedcurl http://ollama:11434/api/tags from the WebUI container.
Connection refusedOllama container stopped or wrong hostnamedocker compose ps and docker compose logs ollama.
Host Ollama is unreachable from Dockerlocalhost points to the WebUI containerUse http://host.docker.internal:11434; on Linux add the host-gateway mapping.
Model is unexpectedly slowCPU fallback, insufficient memory or excessive contextInspect Ollama logs and GPU visibility; try a smaller model tag.
Settings disappear after recreationMissing or wrong volume mountConfirm /app/backend/data and /root/.ollama volumes.
Login tokens break across replicasInconsistent secret keySet one persistent WEBUI_SECRET_KEY for every replica.

Safe update and backup routine

# Back up named volumes before an upgrade
docker run --rm -v open-webui-data:/data   -v "$PWD":/backup alpine   tar czf /backup/open-webui-data.tgz -C /data .

docker compose pull
docker compose up -d
docker compose ps
docker compose logs --tail=100

Test login, model listing, one chat completion and any external tools after every upgrade. Keep the previous tested image tag available for rollback.

Official references

Commands were checked against the linked official documentation on July 31, 2026. Pin versions and test the exact model, driver and container combination you deploy.