Open WebUI With Ollama: Docker Setup and Private AI Chat

14 min read

,
Open WebUI With Ollama: Docker Setup and Private AI Chat

Open WebUI with Ollama gives you a browser-based AI chat app on your own hardware, with chat history, separate user accounts and document search. Ollama runs the models; Open WebUI provides the interface. A phone or laptop on your home network can use both through the same server.

On a Linux server, start with the Docker Compose setup. Open WebUI reaches Ollama over the Docker network, so port 11434 can stay off the LAN. Start with a small model and confirm it responds before adding documents or other users.

What Open WebUI adds on top of Ollama

Ollama is the engine. It downloads open models, runs them on your CPU or GPU and exposes a local API on port 11434. You can chat with it in a terminal, which is how our guide to running AI models locally with Ollama starts. Open WebUI adds separate browser accounts for people sharing that model server.

Open WebUI fills that gap:

  • A browser interface with chat history, model switching, markdown and code rendering, usable from any phone or laptop on your network.
  • Multiple users with roles, so family members or a small team get their own accounts and chat history.
  • Knowledge bases for asking questions across your own PDFs and notes (retrieval-augmented generation, or RAG).
  • Model management so you can pull and remove Ollama models without touching a terminal.
  • Optional cloud connections, so the same interface can talk to OpenAI-compatible APIs when a local model is not enough.

With a local Ollama model and local document processing, your prompts and files can stay on your server. Check the embedding, search, speech and model connections before uploading private material: enabling a cloud provider or an external tool can send data outside your network.

Diagram of what Open WebUI adds on top of Ollama. Ollama is the engine: it downloads open models, runs them on your CPU or GPU and exposes a local API on port 11434; a terminal chat works for one person at one keyboard, but not for a household. Open WebUI fills that gap with a browser interface that has chat history, model switching, markdown and code rendering, usable from any phone or laptop on your network; multiple users with roles, so family members or a small team get their own accounts and chat history; knowledge bases for asking questions across your own PDFs and notes using retrieval-augmented generation, or RAG; and model management so you can pull and remove Ollama models without touching a terminal, with optional cloud connections when a local model is not enough. The privacy angle is the main draw: your prompts, chat history and uploaded documents stay on hardware you control, which matters for client files, medical records or tax papers
Image: Techzei

What you need before you start

  • A machine to run models. A laptop or desktop with 16 GB of RAM handles 4B to 9B models comfortably. A supported GPU with enough VRAM can make responses much faster; the model and context length both affect memory use. An always-on home server is ideal if you want the whole household to use it.
  • Docker. Docker Desktop on Windows or macOS, or Docker Engine with the Compose plugin on Linux.
  • Ollama, installed natively or in Docker. Step 1 covers both.
  • Disk space. The standard Open WebUI image is about 1.6 GB, plus several gigabytes per model.
  • A terminal and about 20 minutes.

Which model should you start with?

The model decides how good the answers are and how fast they arrive. These are approximate Q4 model-weight sizes from the Ollama library, not total disk or memory requirements. Vision projectors, other components and context add overhead. Test your workload before choosing a larger model.

ModelDownload sizeGood forStarting memory estimate
qwen3.5:4b3.3 GBFast everyday chat, summaries8 GB RAM
gemma3:4b3.4 GBGeneral chat, image understanding8 GB RAM
qwen3.5:9b6.6 GBBetter reasoning and writing16 GB RAM or 8 GB VRAM
gemma4:e4b6.6 GBAnother compact model to compare16 GB RAM or 8 GB VRAM
gemma4:12b7.7 GBHigher quality on a mid-range GPU12 GB VRAM recommended
gemma4:26b16 GBLarger model; needs more memory24 GB VRAM or a large unified-memory Mac
nomic-embed-textSmallEmbeddings for document searchRuns alongside a chat model

Start with a 4B model to confirm everything works, then move up. A model that does not fit in VRAM may run partly on the CPU and respond much more slowly. If you write prompts in Hindi or another Indian language, test a few models side by side, because quality varies a lot between model families.

Graphic of which Ollama model to start with in Open WebUI. Sizes are the download sizes for the default quantised versions in the Ollama library. Start with a 4B model: qwen3.5:4b at 3.3 GB for fast everyday chat and summaries, or gemma3:4b at 3.4 GB for general chat and image understanding, both with a practical minimum of 8 GB RAM. Then move up: qwen3.5:9b at 6.6 GB for better reasoning and writing, or gemma4:e4b at 6.6 GB as a strong small model for most homes, both needing 16 GB RAM or 8 GB VRAM. For higher quality, gemma4:12b at 7.7 GB on a mid-range GPU with 12 GB VRAM recommended, or gemma4:26b at 16 GB, the best quality in this list, needing 24 GB VRAM or a large unified-memory Mac. nomic-embed-text is a small embeddings model for document search and runs alongside a chat model. A model that does not fit in VRAM spills into system RAM and slows down sharply. If you write prompts in Hindi or another Indian language, test a few models side by side
Image: Techzei

Step 1: Install Ollama

Pick the option that matches your machine. If Ollama is already installed, skip to Step 2.

Option A: Ollama installed on the host

On Windows and macOS, download the installer from ollama.com. On Linux, the official install script sets up Ollama as a systemd service:

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

Check that it is running and pull a first model:

ollama --version
ollama pull qwen3.5:4b

Ollama listens on 127.0.0.1:11434 by default. Docker Desktop uses host.docker.internal to reach the host. On Linux, a bridge-networked container cannot reach the host’s loopback address. If you need to keep an existing Linux host install, restrict access to port 11434 to your Docker network with the host firewall before changing the bind address. Ollama’s local API has no authentication. If you cannot enforce that restriction, use the Compose setup instead.

sudo systemctl edit ollama.service

Add these lines in the editor that opens, then save:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"

Reload and restart the service:

sudo systemctl daemon-reload
sudo systemctl restart ollama

After restarting Ollama, verify that Open WebUI can connect and that a separate LAN device cannot reach port 11434. Keep that port off your router’s forwarding rules.

Option B: Ollama in Docker

If you prefer everything in containers, the official image works on CPU out of the box:

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

For an NVIDIA GPU, install the NVIDIA Container Toolkit first and add --gpus=all to that command. The Docker Compose file in Step 2 shows how to run both containers together, which is the tidier option.

Step 2: Run Open WebUI with Docker

First generate a secret key and keep it somewhere safe. Open WebUI uses it to sign login tokens, and without a fixed key every recreated container logs everyone out.

openssl rand -hex 32

Now start Open WebUI, replacing your-secret-key with the value you just generated:

docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data -e WEBUI_SECRET_KEY=your-secret-key --name open-webui --restart always ghcr.io/open-webui/open-webui:main

What each part does:

  • -p 3000:8080 publishes the app on port 3000 of your machine. Change the left number if 3000 is taken.
  • --add-host=host.docker.internal:host-gateway lets the container reach an Ollama install running on the host.
  • -v open-webui:/app/backend/data stores chats, users, settings and uploads in a named volume that survives updates. Never run without it.
  • --restart always brings the container back after a reboot.

Without an OLLAMA_BASE_URL setting, Open WebUI looks for Ollama at http://host.docker.internal:11434, which is exactly where a host install lives.

On a home server, a Compose file is easier to update and back up. This example runs Ollama on the CPU and connects Open WebUI to it by container name. GPU access needs additional configuration, such as the NVIDIA Container Toolkit and a GPU reservation on Linux. Docker on macOS does not expose Apple Metal acceleration to the container; run Ollama natively there.

services:
  ollama:
    image: ollama/ollama
    container_name: ollama
    volumes:
      - ollama:/root/.ollama
    restart: unless-stopped

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

volumes:
  ollama:
  open-webui:
    name: open-webui

Save it as docker-compose.yml in a new folder and start it:

docker compose up -d

If Ollama runs on the host instead, delete the ollama service and the depends_on lines, remove OLLAMA_BASE_URL, and add extra_hosts: - "host.docker.internal:host-gateway" to the open-webui service. Note that Ollama is not published on a host port in this file, which keeps its API private to the Docker network in the two-container setup. If Ollama runs on the host and listens on all interfaces, host firewall rules must restrict it separately.

Which Open WebUI image tag to use

TagSizeUse it when
:mainAbout 1.62 GBDefault choice. Includes the bundled speech-to-text and embedding models
:slimAbout 197 MBLow disk space or slow internet. Extra models download on first use
:cudaLargerNVIDIA GPU for Open WebUI’s own embedding and speech models. Add --gpus all
:ollamaLargerAll-in-one container that bundles Ollama inside
:v0.13.3 styleSame as mainProduction use where you want to control when upgrades happen

:main and :latest are rolling tags that change with every release. For a household server that you do not want breaking on its own, pin a version tag and upgrade deliberately.

Step 3: Create the admin account

Open http://localhost:3000, or http://SERVER-IP:3000 from another device on your network. The first screen asks you to create an account.

Open WebUI sign in screen with email and password fields
The first account on a new Open WebUI installation becomes the administrator. Image: Open WebUI

The first account created on a new instance becomes the administrator automatically, and sign-up closes after that. That makes the first visit important. Complete it straight away, on a private network, before the instance is reachable by anyone else. If you are deploying on a server that might be exposed, you can pre-create the admin with the WEBUI_ADMIN_EMAIL and WEBUI_ADMIN_PASSWORD environment variables on first start instead.

Step 4: Connect Ollama and pull models

If you used the commands above, Open WebUI should already see Ollama. To check, open Admin Panel > Settings > Connections. The Ollama API section should show your URL with a working connection.

Open WebUI admin Connections settings showing the Ollama API URL
Check the Ollama endpoint under Connections. Image: Open WebUI

Select Manage next to the Ollama connection to pull or delete models without a terminal. Type a model name such as gemma4:e4b and start the download.

Open WebUI Manage Ollama dialog for pulling a model by name
The model-management dialog downloads models through Ollama. Image: Open WebUI

You can also type a model name directly into the model selector at the top of a new chat. If the model is not installed yet, Open WebUI offers to pull it from Ollama for you.

Open WebUI model selector offering to pull a model from Ollama
A missing model can also be pulled from the chat model selector. Image: Open WebUI

Once a model appears in the selector, start a chat. The first reply takes longer because Ollama loads the model into memory. Later replies are faster.

Step 5: Chat with your own documents

Knowledge bases are where Open WebUI earns its place. You can collect bills, manuals, policy documents or study notes into a collection and ask questions across them.

  1. Go to Workspace > Knowledge and select Create.
  2. Give the knowledge base a name and description.
  3. Upload text-based PDFs or text files and wait for processing to finish.
  4. In a chat, type # and choose the knowledge base, or attach it to a model under Workspace > Models > Edit.
  5. Ask a question whose answer is in the files and compare the cited passage with the original.
Open WebUI knowledge base screen listing uploaded documents
Knowledge bases collect documents for retrieval during a chat. Image: Open WebUI

Retrieval settings such as the embedding model, chunk size and the document extraction engine live under Admin Panel > Settings > Documents. For an all-local setup, pull nomic-embed-text in Ollama and select it as the embedding model there, so your documents are indexed on your own hardware.

Open WebUI admin Documents settings for embedding model and retrieval
Document settings control embeddings and retrieval. Image: Open WebUI

Scanned PDFs without a text layer are the most common reason a knowledge base seems empty. Run them through OCR first.

Step 6: Add family members or colleagues safely

Open WebUI has three roles: admin, user and pending. By default, a new account created after the first one lands in pending, which means no access until an admin approves it.

To add people:

  1. Go to Admin Panel > Users and add the account yourself with an email and a temporary password, then ask them to change it, or
  2. Temporarily enable sign-up, let them register, approve them from the users list, then switch sign-up off again.

Keep the number of admins small. An admin can change connections, see settings and manage every account. For a household, one admin and everyone else as user is the right shape.

Step 7: Reach it from outside your home

The Open WebUI documentation is clear that the app is built for private, trusted networks. It recommends placing it behind a VPN such as WireGuard or Tailscale, a zero-trust access proxy such as Cloudflare Access, or a reverse proxy with authentication, and handling rate limiting at that layer.

For most homes, the simplest secure option is Tailscale. Install it on the server and on your phone, then open http://SERVER-NAME:3000 from anywhere. Nothing is exposed to the public internet. If your broadband sits behind CGNAT, which is common on Indian fibre plans, our guide to accessing a home server behind CGNAT compares Tailscale with Cloudflare Tunnel.

If you do put it behind a domain with Caddy, the official Caddy example is short, because Caddy handles HTTPS certificates and WebSockets automatically:

chat.example.com {
    reverse_proxy localhost:3000
}

When you serve Open WebUI on a domain, set WEBUI_URL to that address and add every address people use to CORS_ALLOW_ORIGIN, separated by semicolons. Missing origins cause “is not an accepted origin” errors and broken live chat.

Backups and updates

Back up the data volume

Everything Open WebUI knows lives in /app/backend/data inside the container: the webui.db database, uploaded files, the vector database for knowledge bases and a cache. The Open WebUI docs warn against relying on the Database download in the admin panel, because SQLite can hold recent writes in a separate WAL file that the download misses.

The safe approach with Docker Compose is to stop the container briefly and archive the whole volume:

docker compose stop open-webui
docker run --rm -v open-webui:/data -v "$PWD":/backup alpine tar czf /backup/open-webui-backup.tgz -C /data .
docker compose start open-webui

The Compose file above explicitly names the data volume open-webui, matching the backup command. For an existing installation, run docker volume ls and substitute its actual volume name before backing up. Keep the Compose file and WEBUI_SECRET_KEY with the backup, and copy the archive off the machine. Downloaded Ollama models can be pulled again; preserve any custom model files separately.

Update Open WebUI

With Compose, updating is two commands:

docker compose pull
docker compose up -d

If you pinned a version tag, change the tag in the file first. Read the release notes before a jump between minor versions, since releases such as v0.13.0 can include database migrations.

Troubleshooting

Open WebUI shows no models. Open Admin Panel > Settings > Connections and check the Ollama URL. With a host install on Linux, Ollama must listen on 0.0.0.0 (Step 1) and the container needs the --add-host flag. With the Compose file above, the URL must be http://ollama:11434, not localhost.

“Connection refused” to 127.0.0.1. Inside a container, localhost means the container itself, not your machine. Use host.docker.internal or the Ollama service name. On Linux, an alternative is running the container with --network=host and OLLAMA_BASE_URL=http://127.0.0.1:11434, in which case the UI is on port 8080.

Everyone gets logged out after an update. The container was recreated without a fixed WEBUI_SECRET_KEY. Set one and keep it in the Compose file.

Replies are extremely slow. The model is too large for your VRAM and is running partly on the CPU. Try a smaller model or a lower quantisation, and close other GPU-heavy apps.

Knowledge base answers ignore the documents. Check that processing finished, that the files contain real text rather than scanned images, and that the chat references the knowledge base with #.

Live chat stalls behind a reverse proxy. WebSockets are blocked or the origin is not allowed. Check your proxy configuration and CORS_ALLOW_ORIGIN.

FAQ

Is Open WebUI free?

Yes. Open WebUI is free to self-host at home. Its code is released under the Open WebUI License, which requires keeping the Open WebUI branding, so read the licence terms before you rebrand it or roll it out inside a business.

Does Open WebUI work without an internet connection?

Yes, once the images and models are downloaded. Chat, knowledge bases and user management can run locally with Ollama when their supporting models and document-processing components are local too. Use the :main image if you want the bundled embedding and speech models available offline from the start.

Can I use Open WebUI with ChatGPT or Gemini as well?

Yes. Under Admin Panel > Settings > Connections you can add OpenAI-compatible API connections alongside Ollama, then pick local or cloud models from the same selector. Prompts sent to cloud models leave your network, so keep sensitive documents on local models.

How much RAM do I need for Open WebUI and Ollama?

Open WebUI itself is light. The model is what needs memory. 8 GB of RAM runs 4B models slowly but usefully, 16 GB is comfortable for 7B to 9B models, and a GPU with 8 GB or more of VRAM gives the biggest speed jump.

Can I run Open WebUI on a Raspberry Pi?

Open WebUI runs on 64-bit ARM, but a Pi is too slow for useful model inference. A better pattern is Open WebUI on a small always-on box and Ollama on a desktop or laptop with a GPU, connected over your home network.

Where are my chats stored?

In the open-webui Docker volume, inside the webui.db database alongside uploads and the vector index. Back up that volume together with your deployment settings and secret key. Any cloud connections or external tools you enable have their own data handling.

Should I use the :ollama all-in-one image?

It is convenient for a quick test, but separate containers are easier to update and troubleshoot, and let you upgrade Ollama and Open WebUI independently. For a long-running household setup, use the Compose file with two services.

About the author