官方文档
本地部署
连接本地 Ollama 服务
在服务器测试中,初次对话耗时较长,后续效率稳定;当前环境为本地离线模式。

对话中可选择模型。由于硬件限制,部分功能暂不测试。

修改 Ollama 配置
宿主机 Ollama 服务地址:http://host.docker.internal:11434


查看本地模型 ID

外部连接设置
在管理后台设置中配置外部连接。

运行页面

综述由AI生成介绍在 Ubuntu 24.04 系统上通过 Docker Compose 本地部署 Open WebUI 并连接 Ollama 服务的方法。内容包括项目拉取、环境变量配置、容器启动及 SearXNG 联网搜索功能的集成设置。同时提供了常见问题的排查建议,如模型加载时间及搜索引擎配置注意事项。

在服务器测试中,初次对话耗时较长,后续效率稳定;当前环境为本地离线模式。

对话中可选择模型。由于硬件限制,部分功能暂不测试。

宿主机 Ollama 服务地址:http://host.docker.internal:11434



在管理后台设置中配置外部连接。


镜像拉取速度可能较慢。
docker compose up -d
由于本地已运行 Ollama 服务,需修改 docker-compose.yaml 及 .env 文件中的 Ollama 配置。
cd open-webui
cp .env.example .env
.env 配置示例:
# .env
# Ollama URL for the backend to connect
# The path '/ollama' will be redirected to the specified backend URL
OLLAMA_BASE_URL='http://host.docker.internal:11434'
# AUTOMATIC1111_BASE_URL="http://localhost:7860"
# For production, you should only need one host as fastapi serves the svelte-kit built frontend and backend from the same host and port.
# To test with CORS locally, you can set something like
CORS_ALLOW_ORIGIN='*'
# For production you should set this to match the proxy configuration (127.0.0.1)
FORWARDED_ALLOW_IPS='*'
# DO NOT TRACK SCARF_NO_ANALYTICS=true
DO_NOT_TRACK=true
ANONYMIZED_TELEMETRY=false
docker-compose.yml 配置示例:
services:
open-webui:
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main}
container_name: open-webui
volumes:
- open-webui:/app/backend/data
ports:
- "${OPEN_WEBUI_PORT-3000}:8080"
environment:
- 'OLLAMA_BASE_URL=http://host.docker.internal:11434'
- 'WEBUI_SECRET_KEY='
extra_hosts:
- host.docker.internal:host-gateway
restart: unless-stopped
volumes:
ollama: {}
open-webui: {}
git clone https://github.com/open-webui/open-webui.git
如有需要可部署 SearXNG,优化参考官方文档:SearXNG | Open WebUI 文档
注意:
开启联网搜索后,受限于硬件及模型性能,效果可能不佳。更换高性能设备和模型可获得更好结果。



开启最上面的联网搜索,并配置宿主机中的 SearXNG 访问地址:http://host.docker.internal:8080/search?q=<query>。否则在对话窗口中无法开启联网搜索或连接到 SearXNG 服务。

配置 docker-compose.yaml 中的 Caddy 端口映射以及取消 host 网络模式,避免被 Firefox 浏览器占用端口。
services:
caddy:
container_name: caddy
image: docker.io/library/caddy:2-alpine
# network_mode: host
restart: unless-stopped
ports:
- "8081:8081"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data:rw
- caddy-config:/config:rw
environment:
- SEARXNG_HOSTNAME=${SEARXNG_HOSTNAME:-http://localhost}
- SEARXNG_TLS=${LETSENCRYPT_EMAIL:-internal}
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "1"
管理员面板/设置 中管理。

微信公众号「极客日志V2」,在微信中扫描左侧二维码关注。展示文案:极客日志V2 zeeklog
生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
随机生成西班牙地址(支持马德里、加泰罗尼亚、安达卢西亚、瓦伦西亚筛选),支持数量快捷选择、显示全部与下载。 在线工具,随机西班牙地址生成器在线工具,online
将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online
将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online
将 Markdown(GFM)转为 HTML 片段,浏览器内 marked 解析;与 HTML转Markdown 互为补充。 在线工具,Markdown转HTML在线工具,online