Skip to the content.

Open WebUI Stack: Private Self-Hosted ChatGPT Alternative with Ollama and SearXNG (Docker Compose)

A ready-to-run Docker Compose stack for a private, self-hosted AI chat: Open WebUI as the chat interface, Ollama for local LLMs, and SearXNG for private web search, plus an optional Caddy HTTPS proxy, backup scripts and a step-by-step setup guide. It is for developers, homelabbers and small teams who want a ChatGPT-style assistant that runs on their own hardware and keeps chats off third-party servers.

Last reviewed: December 2026. Image tags float by default (main, latest). Pin versions in .env once you have a working setup (see Upgrades).


Table of Contents


What you get

Service Image Role Exposed
open-webui ghcr.io/open-webui/open-webui:main Chat UI, users, document upload, RAG, web search orchestration 127.0.0.1:3000
ollama ollama/ollama Runs local models (GGUF) on CPU or GPU Internal only
searxng searxng/searxng Metasearch engine used by Open WebUI for web results Internal only
caddy (optional) caddy:2 Automatic HTTPS reverse proxy 80, 443

Design choices:


Hardware guide

Local model speed depends mostly on memory size and memory bandwidth. Rough guide for 4-bit quantized models (the usual default in Ollama):

Model size Approx. memory for weights Practical hardware Experience
1B to 4B 1 to 3 GB Any modern laptop, CPU only Fast, fine for simple tasks, summaries, autocomplete
7B to 9B 5 to 6 GB 16 GB RAM, or a GPU with 8 GB VRAM Good general assistant
12B to 14B 8 to 10 GB 32 GB RAM Mac, or 12 to 16 GB VRAM Noticeably smarter, slower on CPU
24B to 32B 15 to 20 GB 32 to 64 GB unified memory, or 24 GB VRAM Strong reasoning and coding
70B class 40 GB+ 64 GB+ unified memory, or multiple GPUs Slow on consumer hardware

Add headroom for the context window (KV cache), which grows with context length and parallel requests. As a rough rule, budget an extra 10 to 30% of the weight size for typical context lengths.

Disk: models are 1 to 40+ GB each. Keep at least 50 GB free for a comfortable start.


Quick start (Linux with or without NVIDIA GPU)

Requirements: Docker Engine with the Compose plugin (docker compose version should work), openssl, and git.

git clone https://github.com/Ralpberry-Labs/open-webui-stack.git
cd open-webui-stack

# 1. Create .env with random secrets
./scripts/init-env.sh

# 2a. CPU only
docker compose up -d

# 2b. Or with an NVIDIA GPU (after installing the NVIDIA Container Toolkit)
docker compose -f compose.yaml -f compose.gpu.yaml up -d

# 3. Pull a starter chat model and an embedding model
./scripts/pull-models.sh

# 4. Check everything answers
./scripts/healthcheck.sh

Open http://localhost:3000 and create the first account (it becomes the admin).

To confirm the GPU is used, run a prompt and then:

docker compose exec ollama ollama ps     # PROCESSOR column should show GPU
nvidia-smi                               # on the host

Quick start (macOS, Apple silicon)

Docker on macOS runs containers in a Linux VM without access to the Apple GPU, so a containerized Ollama would be CPU only. Run Ollama natively instead and keep only the UI and search in Docker.

# 1. Install and start Ollama natively (app from https://ollama.com/download, or Homebrew)
brew install ollama
ollama serve            # or launch the Ollama app; it listens on 127.0.0.1:11434

# 2. Pull models on the host
OLLAMA_HOST_MODE=1 ./scripts/pull-models.sh

# 3. Configure the stack to use the host Ollama
./scripts/init-env.sh
sed -i '' 's#^OLLAMA_BASE_URL=.*#OLLAMA_BASE_URL=http://host.docker.internal:11434#' .env

# 4. Start only the UI and search (the ollama container is not started)
docker compose up -d open-webui searxng
./scripts/healthcheck.sh

host.docker.internal resolves to the Mac from inside Docker Desktop containers. The same approach works on Linux thanks to the extra_hosts: host-gateway entry in compose.yaml; on Linux, a host Ollama must listen on an address the Docker bridge can reach (for example OLLAMA_HOST=0.0.0.0:11434, protected by your firewall).


Quick start (Windows)

  1. Install Docker Desktop with the WSL 2 backend.
  2. For NVIDIA GPUs, install a current NVIDIA driver on Windows; GPU support inside WSL 2 containers comes from the driver plus Docker Desktop. Then use compose.gpu.yaml.
  3. Run the Linux steps from a WSL 2 shell (Ubuntu), inside the WSL filesystem (for example ~/self-hosted-ai-stack), not under /mnt/c, for much better file performance.

Alternative: install Ollama natively on Windows and point OLLAMA_BASE_URL at http://host.docker.internal:11434, as on macOS.


First login and admin setup

  1. Open the UI and sign up. The first account becomes admin.
  2. New sign-ups after that get the pending role (set by DEFAULT_USER_ROLE=pending in compose.yaml) and must be approved by an admin. To stop sign-ups completely, disable them in Admin Panel > Settings after creating your users.
  3. In Admin Panel > Settings > Connections, confirm the Ollama connection is green.
  4. In Admin Panel > Settings > Models, set visibility for each model (all users or specific groups).
  5. Set a default model under the model selector so users start with something sensible.

Open WebUI stores many settings in its database after the first start. Environment variables marked as persistent (“ConfigVar”) in the Open WebUI docs, such as the web search settings, only seed the initial value. Change them later in the Admin Panel, or set ENABLE_PERSISTENT_CONFIG=False if you want the environment to always win.


Choosing and pulling models

Browse the Ollama library for current models and sizes. Pull with:

./scripts/pull-models.sh qwen3:8b gemma3:12b       # containerized Ollama
OLLAMA_HOST_MODE=1 ./scripts/pull-models.sh qwen3:8b # host Ollama

Or from the UI: type a model name in the model selector and choose “Pull from Ollama.com”.

A sensible starter set by use case (check the library for newer versions; families update often):

Use What to look for Example tags to try
General chat on modest hardware 3B to 8B instruct model llama3.2:3b, qwen3:8b, gemma3:4b
Better reasoning, 32 GB+ memory 12B to 32B instruct model gemma3:12b, qwen3:14b, qwen3:32b
Coding Code-tuned model Search the library for “coder”
Images in chat (vision) Multimodal model gemma3 (4B and larger accept images), llava
Embeddings for document chat Embedding model nomic-embed-text, mxbai-embed-large

Useful commands:

docker compose exec ollama ollama list          # installed models
docker compose exec ollama ollama ps            # loaded models, CPU/GPU split
docker compose exec ollama ollama rm <model>    # free disk space
docker compose exec ollama ollama show <model>  # parameters, template, license

Quantization: tags without a suffix are usually 4-bit. Higher-precision variants (for example q8_0) are more accurate and need roughly twice the memory. Model pages list available tags.


Web search with SearXNG

The stack wires Open WebUI to the bundled SearXNG automatically:

- ENABLE_WEB_SEARCH=True
- WEB_SEARCH_ENGINE=searxng
- SEARXNG_QUERY_URL=http://searxng:8080/search?q=<query>

Open WebUI substitutes <query> with the search text. In a chat, toggle Web Search in the message input options, then ask a question that needs fresh information.

What happens under the hood:

  1. Open WebUI (optionally) asks the model to generate search queries from your message.
  2. It calls SearXNG with format=json.
  3. It fetches the top result pages, extracts text, and retrieves relevant passages.
  4. The model answers with those passages as context and shows the sources.

SearXNG configuration in searxng/settings.yml:

Test search from inside the stack:

docker compose exec open-webui curl -s "http://searxng:8080/search?q=open+source&format=json" | head -c 400

Search engines may rate-limit or block heavy automated use. Keep WEB_SEARCH_RESULT_COUNT modest (3 to 5), and if one upstream engine keeps failing, disable it in SearXNG’s preferences or settings.yml.

Privacy note: SearXNG sends your queries to the upstream search engines it aggregates, from your server’s IP address, without your browser cookies. That is more private than searching directly, but it is not anonymous.


Chat with your documents

Open WebUI has built-in retrieval-augmented generation (RAG):

Tips for better answers:

  1. In Admin Panel > Settings > Documents, pick an embedding model. Using an Ollama embedding model (such as nomic-embed-text) keeps everything local.
  2. Increase chunk size for long-form documents and decrease it for FAQs; re-index after changing it.
  3. Turn on hybrid search (keyword + vector) and a reranker if your hardware allows; it helps with exact terms like product codes.
  4. Ask models with longer context windows when attaching large files, and set the context length for the model (see Performance tuning).
  5. Scanned PDFs have no text layer. Enable an OCR-capable content extraction engine in Documents settings, or convert them first.

Adding cloud models (optional)

You can mix local models with hosted APIs in the same UI. Keys are stored by Open WebUI and requests go from your server to the provider, so those chats are no longer fully private.

- OPENAI_API_BASE_URL=https://api.openai.com/v1
- OPENAI_API_KEY=${OPENAI_API_KEY}

Use per-model access control so only approved users can reach paid models, and watch usage on the provider dashboard.


Remote access and HTTPS

The UI is bound to 127.0.0.1. Pick one way to reach it from other devices.

Option A: private network with Tailscale (simplest, nothing public)

Install Tailscale on the server and your devices, then on the server:

tailscale serve --bg 3000

This serves the UI over HTTPS to devices in your tailnet only. Check tailscale serve --help for options in your version.

Option B: public domain with automatic HTTPS (Caddy)

  1. Point a DNS record (chat.example.com) at the server and open ports 80 and 443.
  2. In .env, set DOMAIN=chat.example.com and WEBUI_URL=https://chat.example.com.
  3. Start with the https profile:
docker compose --profile https up -d

Caddy obtains and renews certificates automatically (caddy/Caddyfile). Before exposing the UI publicly, complete the Security checklist.

Option C: SSH tunnel (zero setup, one user)

ssh -N -L 3000:127.0.0.1:3000 user@your-server
# then open http://localhost:3000 on your laptop

Security checklist


Backups and restore

Chats, users, settings, uploaded files and the document index live in the open-webui volume. Models in the ollama volume can always be re-downloaded.

./scripts/backup.sh                       # -> backups/open-webui-YYYYMMDD-HHMMSS.tar.gz
INCLUDE_MODELS=1 ./scripts/backup.sh      # also archive models (large)
./scripts/restore.sh backups/open-webui-20261201-101500.tar.gz

backup.sh stops the open-webui container for a few seconds to get a consistent database copy, then starts it again. Schedule it with cron:

30 3 * * * cd /opt/open-webui-stack && ./scripts/backup.sh >> backups/backup.log 2>&1

Copy the backups/ folder off the machine (another disk, object storage, a NAS). A backup on the same disk is not a backup. Keep the .env file with the backup in a safe place: WEBUI_SECRET_KEY is used to encrypt some stored data, so restoring data with a different key can break logins and saved credentials.


Upgrades

./scripts/backup.sh
docker compose pull
docker compose up -d
docker image prune -f

For predictable upgrades, pin versions in .env, for example:

OPEN_WEBUI_TAG=<a release tag from the Open WebUI releases page>
OLLAMA_TAG=<a release tag from the Ollama releases page>

Find tags on the Open WebUI releases and Ollama releases pages. Read release notes for database migrations or renamed settings before jumping several versions. Downgrades after a database migration are not guaranteed to work; restore the backup instead.


Performance tuning

Ollama settings go in the environment of the ollama service (or your host environment for a native install). Common ones:

Variable Effect
OLLAMA_KEEP_ALIVE How long a model stays loaded after the last request (default here 30m). Longer = faster first token, more memory held
OLLAMA_NUM_PARALLEL Parallel requests per model. More = better for many users, more memory for context
OLLAMA_MAX_LOADED_MODELS How many different models may be in memory at once
OLLAMA_CONTEXT_LENGTH Default context window for models that do not set one
OLLAMA_FLASH_ATTENTION Set to 1 to enable flash attention where supported; reduces memory use for long contexts

Check the Ollama FAQ for the full, current list and defaults.

Other levers:


Troubleshooting

Problem Check Fix
UI loads but no models listed Admin Panel > Connections shows Ollama red docker compose logs ollama; verify OLLAMA_BASE_URL; pull a model
host.docker.internal not reachable (Linux) Host Ollama listens on 127.0.0.1 only Set OLLAMA_HOST=0.0.0.0:11434 for the host service and restrict with a firewall, or use the bundled container
Web search returns nothing / 403 docker compose logs searxng Ensure json is in search.formats; restart searxng
Web search settings ignored after editing compose Persistent config in database Change them in Admin Panel, or set ENABLE_PERSISTENT_CONFIG=False
Very slow responses ollama ps shows CPU or a CPU/GPU split Smaller model or quantization, shorter context, check GPU passthrough
could not select device driver "nvidia" NVIDIA Container Toolkit missing Install it and restart Docker, or start without compose.gpu.yaml
Out of memory, container restarts docker stats, dmesg Smaller model, lower OLLAMA_NUM_PARALLEL, OLLAMA_MAX_LOADED_MODELS=1
Compose error Set WEBUI_SECRET_KEY in .env .env missing Run ./scripts/init-env.sh
Logged out after restore or upgrade Secret key changed Use the same WEBUI_SECRET_KEY as the data was created with
Port 3000 already in use lsof -i :3000 Change WEBUI_PORT in .env

Logs for everything: docker compose logs -f --tail=100.


How the pieces fit

 Browser ──HTTPS──► [caddy] (optional)
                       │
                       ▼
               [open-webui :8080] ── users, chats, files, RAG index (volume: open-webui)
                 │            │
     chat/embed  │            │  search?q=...&format=json
                 ▼            ▼
          [ollama :11434]  [searxng :8080] ──► public search engines
          models (volume: ollama)

All services share the default Compose network, so they reach each other by service name (ollama, searxng, open-webui).


Files in this repo

open-webui-stack/
├── compose.yaml            # main stack: open-webui, ollama, searxng, caddy (profile "https")
├── compose.gpu.yaml        # NVIDIA GPU override for ollama
├── .env.example            # settings and secrets template
├── searxng/settings.yml    # minimal private SearXNG config with JSON output
├── caddy/Caddyfile         # automatic HTTPS reverse proxy
├── scripts/
│   ├── init-env.sh         # create .env with random secrets
│   ├── pull-models.sh      # pull models into Ollama (container or host)
│   ├── healthcheck.sh      # verify all services respond
│   ├── backup.sh           # archive the open-webui (and optionally ollama) volume
│   └── restore.sh          # restore an archive into the open-webui volume
└── tests/validate.sh       # static checks: script syntax, compose rendering, SearXNG JSON

Run the static checks (no containers started, nothing downloaded):

bash tests/validate.sh

FAQ

Is this really private? With local models only, prompts and documents never leave your machine, except web searches (sent to search engines via SearXNG) and model downloads. Adding cloud connections changes that for chats using those models.

Can several people use it at once? Yes. Open WebUI has users, groups and roles. Throughput depends on your hardware; raise OLLAMA_NUM_PARALLEL and make sure memory allows it.

Can I use another inference server instead of Ollama? Yes. Any OpenAI-compatible server (for example llama.cpp’s llama-server, vLLM, LM Studio’s server) can be added as an OpenAI API connection in Open WebUI. Remove or keep the ollama service as you like.

Do I need SearXNG? No. Open WebUI supports several search providers (some need API keys). SearXNG is included because it is self-hosted and needs no key.

How do I move to another server? Copy the repo folder, your .env, and a backup archive. Run restore.sh on the new machine, then pull models again (or restore the models archive).

Where are the Open WebUI docs? At docs.openwebui.com. For Ollama, see docs.ollama.com; for SearXNG, docs.searxng.org.


Self-hosted chat UIs compared

Open WebUI is one of several self-hosted chat front ends. Licenses as declared in each repository at review time.

Project License Strengths Consider it when
Open WebUI Open WebUI License (BSD-3-style with branding conditions) Polished UI, users and groups, RAG, web search, tools and pipelines, Ollama-first You want an all-in-one private ChatGPT-style app
LibreChat MIT Many providers, agents, MCP, multi-user auth options You mainly use hosted APIs and want broad provider support
AnythingLLM MIT Document workspaces, desktop and server versions, agents Document chat is the main use case
LobeHub Custom (see repo) Modern UI, plugin and agent marketplace You want a consumer-style UI with plugins
Jan See repo Desktop app that runs models locally One user on one machine, no server
LM Studio Proprietary (free to use; see terms) Desktop model runner with a local OpenAI-compatible server You want a GUI to download and run models; pairs with Open WebUI

Note on Open WebUI’s license: recent versions use a custom license with BSD-style permissions plus a branding clause. At review time it prohibits altering or removing “Open WebUI” branding unless the deployment has at most 50 end users in a rolling 30-day period, or you have written permission or an enterprise license. Read the current license before white-labeling.


Picking local models by hardware

Model families change every few months, so pick by size class and check the Ollama library for the current best in each class.

Your machine Chat model size Embedding model Notes
8 GB RAM laptop, no GPU 1B to 4B nomic-embed-text Keep context modest; good for summaries and simple Q&A
16 GB RAM or 8 GB VRAM 7B to 9B (4-bit) nomic-embed-text Solid daily assistant
32 GB unified memory or 12 to 16 GB VRAM 12B to 14B mxbai-embed-large Better reasoning and coding
64 GB unified memory or 24 GB VRAM 24B to 32B mxbai-embed-large Strong general and coding performance
128 GB unified memory or multi-GPU 70B class or large mixture-of-experts models any Near cloud quality on many tasks, slower

Rules of thumb: prefer a newer model at the same size over an older bigger one; check that the model supports tool calling if you plan to use tools or agents; and use a vision-capable model if you want to paste screenshots.


Team setup checklist

For a small company or lab (5 to 50 people):

  1. Hardware: one GPU server sized for the largest model you need, or a Mac Studio-class machine; plan memory for concurrent users (OLLAMA_NUM_PARALLEL).
  2. HTTPS and a domain with the https profile, or a VPN (Tailscale) for internal-only access.
  3. Single sign-on: Open WebUI supports OAuth/OIDC providers; configure your identity provider so accounts follow your directory.
  4. Groups and permissions: create groups (engineering, support), give each access to the right models and knowledge bases.
  5. Default model and system prompts: create workspace model presets with your company’s instructions.
  6. Knowledge bases: one per team or topic, owned by someone who keeps them current.
  7. Cloud models (optional): add hosted APIs for hard tasks, restricted to groups that need them, with spend limits at the provider.
  8. Backups scheduled and a restore tested (Backups and restore).
  9. Usage policy: a short page on what data may be used with which models.
  10. Updates: a monthly maintenance window with pinned versions and release notes read.

Extending Open WebUI

Extension type What it does Example uses
Tools Python functions the model can call during a chat Look up an order, query a database, call an internal API
Functions (filters, actions, pipes) Modify inputs/outputs, add buttons, or add custom “models” backed by code Redact PII before sending, translate outputs, route to another backend
Pipelines A separate service for heavier custom processing Rate limiting, custom RAG, monitoring
MCP / OpenAPI tool servers Connect external tool servers Reuse tools you already expose to other agents

All of these run code on your server. Install only what you have reviewed, and restrict who can add them (admin only by default is a good policy).


More FAQ

Is Open WebUI really free? Yes, it is free to self-host. Its license restricts removing Open WebUI branding for deployments above 50 end users without permission; read it if you plan to rebrand.

Can Open WebUI use ChatGPT, Claude or Gemini? It can connect to any OpenAI-compatible API, and many providers (or gateways in front of them) offer one. Those chats then go to the provider.

How many users can one server handle? It depends on model size, GPU memory and how many people chat at the same moment. A single modern GPU serving a 7B to 14B model typically supports a small team; raise OLLAMA_NUM_PARALLEL and watch memory.

Why is the first answer slow and later ones fast? The first request loads the model into memory. OLLAMA_KEEP_ALIVE controls how long it stays loaded.

Can I run this on a Raspberry Pi? The UI runs, but local models will be very slow. Point it at Ollama on a stronger machine or at a hosted API.

Is my data used to train models? Not with local models. For hosted API connections, check each provider’s data policy.


Where to go next



Contributing

PRs are welcome: fixes when upstream settings change, AMD and Intel GPU overrides that you have tested, more scripts, and troubleshooting entries. Please keep entries accurate, test changes with bash tests/validate.sh and on a real machine, and never commit secrets.

License

Code and configuration are released under the MIT License. Open WebUI, Ollama, SearXNG and Caddy are separate projects with their own licenses; review them before deploying, especially for commercial or branded use.

If this helped you, a star helps others find it.

More free resources

Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.