当前位置: 首页 > news >正文

解决docker安装OpenWebUI 报错 500

你在访问 Web UI 时遇到 500 错误,可能是由于以下几个原因导致的:

1. ​​OpenAI 配置冲突​​

从配置中可以看到:

json
"openai": {"enable": true,   // 开启"api_base_urls": ["https://api.openai.com/v1"],"api_keys": [""],  // 密钥为空"api_configs": {"0":{}}
}

当 openai.enable=true 时,系统会尝试调用 OpenAI 的接口,但你的 api_keys 为空,会导致服务端认证失败。
如果服务端没有正确处理空密钥的情况,会直接抛出 500 错误。

2.解决方案:​​

如果不需要 OpenAI 功能,保持 enable: false。

"openai": {"enable": false,   // 已被你禁用"api_base_urls": ["https://api.openai.com/v1"],"api_keys": [""],  // 密钥为空"api_configs": {"0":{}}
}

如果需要 OpenAI,需填写有效的 API 密钥:

json
"openai": {"enable": true,"api_keys": ["sk-your-api-key-here"]  // 替换为有效密钥
}

3.关闭OpenAI 功能解决办法

​​1. 查看容器挂载详情​

[root@koji-builder ~]# docker inspect open-webui | grep -A 10 "Mounts""Mounts": [{"Type": "volume","Name": "open-webui","Source": "/var/lib/docker/volumes/open-webui/_data","Destination": "/app/backend/data","Driver": "local","Mode": "z","RW": true,"Propagation": ""}
[root@koji-builder ~]# 

2.定位文件位置

[root@koji-builder ~]# cd /var/lib/docker/volumes/open-webui/_data
[root@koji-builder _data]# ls
cache  uploads  vector_db  webui.db 
[root@koji-builder _data]# 

​​2. 修改修改 config 表中 openai.enable 字段

如果不修改的话,会报500,因为openwebui使用了openai的api,如果不能访问外网的情况下,需要修改数据库表的openai.enable 字段

1.安装sqlite

yum install sqlite

2.备份数据库和停止 Open WebUI 容器​

sudo cp webui.db webui.db.bak
#停止 Open WebUI 容器​
docker stop open-webui

3. 进入 SQLite 交互模式​

[root@koji-builder _data]# sqlite3  webui.db 
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> 

4. 查看所有表,是否有config 表

sqlite> .tables 
alembic_version   config            group             model           
auth              document          knowledge         prompt          
channel           feedback          memory            tag             
channel_member    file              message           tool            
chat              folder            message_reaction  user            
chatidtag         function          migratehistory  
sqlite> 

5. 修改config 表"openai":{"enable"是的修改true

#修改
sqlite> UPDATE config ...> SET data = json_set(...>   data, ...>   '$.openai.enable', ...>   json('false')  ...> ) ...> WHERE id = 1;
#-- 验证结果
sqlite> SELECT json_extract(data, '$.openai.enable') FROM config WHERE id = 1;
0

6. 查看config 表中的"openai":{"enable"是的修改false

sqlite> select * from config;
1|{"version":0,"ui":{"default_locale":"","prompt_suggestions":[{"title":["Help me study","vocabulary for a college entrance exam"],"content":"Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."},{"title":["Give me ideas","for what to do with my kids' art"],"content":"What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter."},{"title":["Tell me a fun fact","about the Roman Empire"],"content":"Tell me a random fun fact about the Roman Empire"},{"title":["Show me a code snippet","of a website's sticky header"],"content":"Show me a code snippet of a website's sticky header in CSS and JavaScript."},{"title":["Explain options trading","if I'm familiar with buying and selling stocks"],"content":"Explain options trading in simple terms if I'm familiar with buying and selling stocks."},{"title":["Overcome procrastination","give me tips"],"content":"Could you start by asking me about instances when I procrastinate the most and then give me some suggestions to overcome it?"},{"title":["Grammar check","rewrite it for better readability "],"content":"Check the following sentence for grammar and clarity: \"[sentence]\". Rewrite it for better readability while maintaining its original meaning."}],"enable_signup":false},"ollama":{"enable":true,"base_urls":["http://172.16.104.203:11434"],"api_configs":{"0":{}}},"openai":{"enable":false,"api_base_urls":["https://api.openai.com/v1"],"api_keys":[""],"api_configs":{"0":{}}}}|0|2025-04-14 08:07:08|2025-04-14 08:50:11.453672
sqlite> 
#-- 退出
sqlite> .quit

7. 重启open-webui容器

[root@koji-builder _data]# docker start  open-webui 
open-webui
如果启动后没有反应需要进容器里启动
[root@koji-builder _data]# docker  exec -it open-webui /bin/bash
root@69d9b2ad6b44:/app/backend# ls
data  dev.sh  open_webui  requirements.txt  start.sh  start_windows.bat
root@69d9b2ad6b44:/app/backend# ./start.sh 

​​3. 访问open-webui

http://ip:3000

在这里插入图片描述

相关文章:

  • Node.js 数据库 CRUD 项目示例
  • uni-app/微信小程序接入腾讯位置服务地图选点插件
  • STM32F407实现SD卡的读写功能
  • #[特殊字符]Rhino建模教程 · 第一章:正方体建模入门
  • docker 启用portainer,容器管理软件
  • Flowable工程化改造相关文档
  • AI大模型如何重塑科研范式:从“假说驱动”到“数据涌现”
  • 11【模块学习】DS18B20(一):使用学习
  • 免费的内网穿刺工具和免费域名
  • **Windows 系统**的常用快捷键大全
  • C语言实战:用Pygame打造高难度水果消消乐游戏
  • Linux路漫漫
  • 千树万树梨花开
  • 【18】Strongswan encoding详解 message2
  • 面试题:请描述一下你在项目中是如何进行性能优化的?针对哪些方面进行了优化,采取了哪些具体的措施?
  • 【JavaScript】二十一、日期对象
  • 数据结构*集合框架顺序表-ArrayList
  • 网络的起点:深入解析计算机网络中的网络接口层
  • 在JavaScript中实现文件下载完成后自动打开
  • Python multiprocessing模块介绍
  • 四川公布一起影视盗版案例:1个网站2人团伙盗售30多万部
  • 安徽铁塔再通报“会议室不雅行为”事件:涉事员工停职检查
  • 王宝强谈《棋士》:饰演这个灰度人物有一种被割裂的痛苦
  • 航空货运三巨头去年净利合计超88亿元,密切关注关税政策变化和市场反应
  • 安徽临泉一小区交付后多楼层现裂缝,专家组论证称不影响安全
  • 全球最大车展在上海启幕,解放日报头版头条:“看懂上海车展,就能预判未来”