干翻全岛蛙蛙 发表于 6 天前

【dify折腾记01】Windows本地化摆设:容器db-1一直报FATAL: data directory “/var/lib/postgresql/data

原文链接
https://blog.csdn.net/weixin_65429391/article/details/141888157
由于担心原文作者撤档,复制一个
Windows11情况摆设本地化dify,docker compose up -d 启动后,一直报错,雷同:
在windows11下部署dify报错:

db-1| The files belonging to this database system will be owned by user "postgres".
db-1| This user must also own the server process.
db-1|
db-1| The database cluster will be initialized with locale "en_US.utf8".
db-1| The default database encoding has accordingly been set to "UTF8".
db-1| The default text search configuration will be set to "english".
db-1|
db-1| Data page checksums are disabled.
db-1|
db-1| fixing permissions on existing directory /var/lib/postgresql/data/pgdata ... ok
db-1| creating subdirectories ... ok
db-1| selecting dynamic shared memory implementation ... posix
db-1| selecting default max_connections ... 20
db-1| selecting default shared_buffers ... 400kB
db-1| selecting default time zone ... UTC
db-1| creating configuration files ... ok
db-1| 2025-02-28 16:06:21.008 UTC FATAL:data directory "/var/lib/postgresql/data/pgdata" has invalid permissions
db-1| 2025-02-28 16:06:21.008 UTC DETAIL:Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
db-1| child process exited with exit code 1
db-1| initdb: removing contents of data directory "/var/lib/postgresql/data/pgdata"
db-1 exited with code 1
重点就是这句:

FATAL: data directory "/var/lib/postgresql/data/pgdata" has invalid permissions
解决办法:


[*]进入dify源码的docker目录下,打开docker-compose.yaml:
找到services下的db,修改volumes,将./volumes/db/data改为postgres-data。
https://i-blog.csdnimg.cn/direct/a80d4a54be6b4d3688b29c759c9f3532.png
在docker-compose.yaml文件的最末端的volumes下添加postgres-data:
https://i-blog.csdnimg.cn/direct/7fbc627260704b02a98fc0538a4b7684.png
注意,该volumes与services同级。

[*]在Docker Desktop运行的情况下,win+r打开cmd,进入dify源码的docker目录下:
实行:
docker-compose down
docker-compose up
搞定。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 【dify折腾记01】Windows本地化摆设:容器db-1一直报FATAL: data directory “/var/lib/postgresql/data