docker启动anything llm报unable to open database file: ../storage/anythingllm.db问题及解决
docker启动anything llm报unable to open database file: ../storage/anythingllm.db
docker的安装和anything llm镜像的下载就不在过多介绍,下载docker和镜像的时候,记得切换到国内源,否则很可能下载速度缓慢或者下载失败。
运行命令参考的是官网的命令
export STORAGE_LOCATION=$HOME/anythingllm && \
mkdir -p $STORAGE_LOCATION && \
touch "$STORAGE_LOCATION/.env" && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm
但是总会报错
Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db" Error: Schema engine error: SQLite database error unable to open database file: ../storage/anythingllm.db
最初以为是映射问题
总在映射上找原因,搜索了很多,但是没有能够解决问题的办法。
浏览了下官网的安装文档
发现了一个比较奇怪的说明,具体链接
The UID and GID are set to 1000 by default. This is the default user in the Docker container and on most host operating systems.
If there is a mismatch between your host user UID and GID and what is set in the .env file, you may experience permission issues.
1000是linux普通用户的标识,而docker run的时候使用的是root,所以没有往权限方面想,难道是映射的文件夹权限不足?
于是:
chmod 777 anythingllm
再次运行,果然成功了。
总结
因为docker运行时创建文件的用户是uid为1000的普通用户,如果使用root进行目录创建,普通用户是无法写入文件的,所以导致运行的时候报错,修改目录权限即可。
当然如果觉得777权限过大,可以通过chown改变目录所有者为uid为1000的用户。
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
keepalived+nginx+httpd实现的双机热备+负载均衡
本文主要介绍了keepalived + nginx + httpd 实现的双机热备+负载均衡,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2025-07-07
Docker容器部署Elasticsearch并配置分词器的方法实现
本文主要介绍了Docker容器部署Elasticsearch并配置分词器,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2026-04-04
docker+gitlab+gitlab-runner部署详解
这篇文章主要介绍了docker+gitlab+gitlab-runner部署详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2020-10-10


最新评论