解决dify docker-plugin_daemon-1启动报错:failed to connect to `host=db_postgres user=postgres..`

2025博客之星年度评选已开启 10w+人浏览 852人参与

一、问题发现

在版本升级时(1.6.0–>1.11.1),发现容器docker-plugin_daemon-1启动后日志报错:failed to connect to host=db_postgres user=postgres database=dify_plugin: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving),导致页面一直报500错误

二、解决步骤

1.

修改docker-compose.yaml配置文件(/dify/docker目录下),在plugin daemon容器配置尾部添加网络配置:
在这里插入图片描述

networks:
  - ssrf_proxy_network
  - default

保存后执行:

sudo docker compose down
sudo docker compose up -d

2.

如果上述步骤执行后还未解决,可以重新打开docker-compose.yaml配置文件,找到db_postgres配置块,为 PostgreSQL 服务添加网络别名,在尾部加上:
在这里插入图片描述

networks:
  ssrf_proxy_network:
    aliases:
      - db
  default:

保存后再执行:

sudo docker compose --profile postgresql up -d

到这里应该就能看到docker-plugin_daemon-1启动正常,dify页面也能正常打开了

在Ubuntu22.04上查看docker的log信息,执行“docker logs docker-plugin_daemon-1 --tail 100”,log报错“2025/03/17 08:04:16 /app/internal/db/init.go:21 [error] failed to initialize database, got error failed to connect to `host=db user=postgres database=postgres`: failed SASL auth (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01)) 2025/03/17 08:04:16 init.go:144: [PANIC]failed to init dify plugin db: failed to connect to `host=db user=postgres database=postgres`: failed SASL auth (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01)) panic: [PANIC]failed to init dify plugin db: failed to connect to `host=db user=postgres database=postgres`: failed SASL auth (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01))%!(EXTRA *pgconn.ConnectError=failed to connect to `host=db user=postgres database=postgres`: failed SASL auth (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01))) goroutine 1 [running]: github.com/langgenius/dify-plugin-daemon/internal/utils/log.writeLog({0x15fb9aa, 0x5}, {0x16297bf?, 0x7?}, 0x1, {0xc0006bfd00, 0x1, 0x1}) /app/internal/utils/log/log.go:40 +0x326 github.com/langgenius/dify-plugin-daemon/internal/utils/log.Panic(...) /app/internal/utils/log/log.go:66 github.com/langgenius/dify-plugin-daemon/internal/db.Init(0x2710?) /app/internal/db/init.go:144 +0xde github.com/langgenius/dify-plugin-daemon/internal/server.(*App).Run(0xc00012aa20, 0xc0001f3b08) /app/internal/server/server.go:55 +0xd2 main.main() /app/cmd/server/main.go:28 +0xff 2025/03/17 08:04:17 pool.go:32: [INFO]init routine pool, size: 10000 ”
03-18
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值