【AI】ubuntu平台docker部署open-webui,配置模型 中文 提示词

前提:

ollama本地部署的,采用内网地址通知到open-webui

调整ollama.service

配置监听地址

Environment="OLLAMA_HOST=:11434"

避免监听127.0.0.1:11434

[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Environment="OLLAMA_HOST=:11434"
[Install]
WantedBy=default.target

安装

docker-compose.yml配置

version: '3.8'

services:
  open-webui:
    image: ghcr.nju.edu.cn/open-webui/open-webui:main
    container_name: open-webui
    ports:
      - "3000:8080"
    environment:
      - OLLAMA_BASE_URL=http://192.168.1.3:11434
    volumes:
      - open-webui_data:/app/backend/data    
    restart: always

volumes:
  open-webui_data:

注意采用 ghcr.nju.edu.cn 加速地址

启动服务

docker-compose up -d
yeqiang@yeqiang-Default-string:/usr/local/open-webui$ docker-compose up -d
Pulling open-webui (ghcr.nju.edu.cn/open-webui/open-webui:main)...
main: Pulling from open-webui/open-webui
c29f5b76f736: Pull complete
73c4bbda278d: Pull complete
acc53c3e87ac: Pull complete
ad3b14759e4f: Pull complete
b874b4974f13: Pull complete
4f4fb700ef54: Pull complete
dfcf69fcbc2b: Pull complete
e8bfaf4ee0e0: Pull complete
17b8c991f4f9: Pull complete
2d1f3e8f8037: Pull complete
9bc058e9f913: Pull complete
4ec78f0a5387: Pull complete
8362126344e9: Pull complete
8fbadd293f58: Pull complete
00f8bd1845fc: Pull complete
Digest: sha256:1623214ac0c180cc1f527df3c2cb2be69bd0911016a565edc15e91b4e6ab99dd
Status: Downloaded newer image for ghcr.nju.edu.cn/open-webui/open-webui:main
Creating open-webui ... done

日志

yeqiang@yeqiang-Default-string:/usr/local/open-webui$ docker logs -f b89
Loading WEBUI_SECRET_KEY from file, not provided as an environment variable.
Generating WEBUI_SECRET_KEY
Loading WEBUI_SECRET_KEY from .webui_secret_key
/app/backend/open_webui
/app/backend
/app
Running migrations
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 7e5b5dc7342b, init
INFO  [alembic.runtime.migration] Running upgrade 7e5b5dc7342b -> ca81bd47c050, Add config table
INFO  [alembic.runtime.migration] Running upgrade ca81bd47c050 -> c0fbf31ca0db, Update file table
INFO  [alembic.runtime.migration] Running upgrade c0fbf31ca0db -> 6a39f3d8e55c, Add knowledge table
INFO  [alembic.runtime.migration] Running upgrade 6a39f3d8e55c -> 242a2047eae0, Update chat table
INFO  [alembic.runtime.migration] Running upgrade 242a2047eae0 -> 1af9b942657b, Migrate tags
INFO  [alembic.runtime.migration] Running upgrade 1af9b942657b -> 3ab32c4b8f59, Update tags
INFO  [alembic.runtime.migration] Running upgrade 3ab32c4b8f59 -> c69f45358db4, Add folder table
INFO  [alembic.runtime.migration] Running upgrade c69f45358db4 -> c29facfe716b, Update file table path
INFO  [alembic.runtime.migration] Running upgrade c29facfe716b -> af906e964978, Add feedback table
INFO  [alembic.runtime.migration] Running upgrade af906e964978 -> 4ace53fd72c8, Update folder table and change DateTime to BigInteger for timestamp fields
INFO  [alembic.runtime.migration] Running upgrade 4ace53fd72c8 -> 922e7a387820, Add group table
INFO  [alembic.runtime.migration] Running upgrade 922e7a387820 -> 57c599a3cb57, Add channel table
INFO  [alembic.runtime.migration] Running upgrade 57c599a3cb57 -> 7826ab40b532, Update file table
INFO  [alembic.runtime.migration] Running upgrade 7826ab40b532 -> 3781e22d8b01, Update message & channel tables
INFO  [open_webui.env] 'DEFAULT_LOCALE' loaded from the latest database entry
INFO  [open_webui.env] 'DEFAULT_PROMPT_SUGGESTIONS' loaded from the latest database entry
WARNI [open_webui.env] 

WARNING: CORS_ALLOW_ORIGIN IS SET TO '*' - NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS.

INFO  [open_webui.env] Embedding model set: sentence-transformers/all-MiniLM-L6-v2
WARNI [langchain_community.utils.user_agent] USER_AGENT environment variable not set, consider setting it to identify your requests.
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
Creating knowledge table
Migrating data from document table to knowledge table
Converting 'chat' column to JSON
Renaming 'chat' column to 'old_chat'
Adding new 'chat' column of type JSON
Dropping 'old_chat' column
Primary Key: {'name': None, 'constrained_columns': []}
Unique Constraints: [{'name': 'uq_id_user_id', 'column_names': ['id', 'user_id']}]
Indexes: [{'name': 'tag_id', 'column_names': ['id'], 'unique': 1, 'dialect_options': {}}]
Creating new primary key with 'id' and 'user_id'.
Dropping unique constraint: uq_id_user_id
Dropping unique index: tag_id

  ___                    __        __   _     _   _ ___
 / _ \ _ __   ___ _ __   \ \      / /__| |__ | | | |_ _|
| | | | '_ \ / _ \ '_ \   \ \ /\ / / _ \ '_ \| | | || |
| |_| | |_) |  __/ | | |   \ V  V /  __/ |_) | |_| || |
 \___/| .__/ \___|_| |_|    \_/\_/ \___|_.__/ \___/|___|
      |_|


v0.5.12 - building the best open-source AI user interface.

https://github.com/open-webui/open-webui

注意,会在WARNING: CORS_ALLOW_ORIGIN IS SET TO '*' - NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS.卡上一段时间,估计下载资源。

使用

耐心等待一段时间(白屏),显示更新信息

左下角,用户名,打开管理员面板

设置,外部链接,关闭OpenAI API(没有梯子,避免卡界面)

切换到模型配置

点击模型,配置提示词,配置公开(其他用户就可以看到,如果只有自己,不用公开来)

你是一位经验丰富的高级程序员、架构师及项目经理,精通多种编程语言和技术框架。你的任务是为我提供专业的程序开发指导,包括但不限于项目架构设计、代码编写最佳实践、技术选型建议以及团队管理技巧。

请始终使用中文回答我的问题,并根据我的具体需求给出详细、清晰的解释和建议。例如,当我询问如何优化一段代码时,请从性能、可读性、维护性等多个角度进行分析,并提供具体的改进方案;当我咨询关于项目管理的问题时,请结合实际案例分享有效的管理策略和方法。

此外,请时刻关注最新的技术趋势和最佳实践,以便给我最前沿的指导。如果涉及到特定的技术或工具,请简要介绍其背景知识,以帮助我更好地理解你的建议。

现在,请准备好开始解答我的问题。

### 使用Docker镜像中的Open-WebUI 对于希望利用Docker容器来部署和管理应用程序的用户来说,使用预构建的Docker镜像是非常方便的选择。针对Open-WebUI的应用场景,在启动之前需要确保已经安装并配置Docker环境[^1]。 #### 安装Docker 为了能够顺利运行Open-WebUI,首先应当获取并设置Docker环境。可以通过访问官方文档页面按照指导完成安装过程。 ```bash sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io ``` #### 获取Open-WebUI Docker镜像 一旦Docker准备就绪,则可以拉取所需的Open-WebUI镜像文件。通常情况下,这类特定用途的镜像可以在Docker Hub上找到,或者是通过其他可信源获得。例如,如果目标是运行Stable Diffusion WebUI,那么可以从指定仓库中提取相应的镜像版本[^2]。 ```bash docker pull siutin/stable-diffusion-webui-docker:latest ``` #### 启动Open-WebUI服务 成功下载镜像之后,下一步就是创建一个新的容器实例,并将其映射到主机上的端口以便于外部访问。下面是一个简单的命令示例用于启动带有默认参数的服务: ```bash docker run -it --rm --name=webui-container-name \ -v /path/to/config:/root/.cache/huggingface/transformers \ -p 7860:7860 \ siutin/stable-diffusion-webui-docker ``` 此操作将会把本地路径`/path/to/config`挂载至容器内部作为持久化存储位置,同时开放7860端口供浏览器连接界面。 #### 访问Open-WebUI界面 当上述步骤完成后,应该能够在浏览器地址栏输入`http://localhost:7860`来查看正在运行的Open-WebUI应用界面。此时可以根据界面上提示进一步调整各项功能选项以及加载不同的AI模型进行测试或实际工作流程支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值