gpt4 book ai didi

postgresql - PostgreSQL的CI/CD管道失败,出现 “Database is uninitialized and superuser password is not specified”错误

转载 作者:行者123 更新时间:2023-12-02 17:06:40 33 4
gpt4 key购买 nike

我正在将Bitbucket管道与PosgreSQL用于CI/CD。据此documentation,PostgreSQL服务已在bitbucket-pipelines.yml中以以下方式描述:

definitions:
services:
postgres:
image: postgres:9.6-alpine

到现在为止一切正常。但是我所有的最新管道均失败,并出现以下错误:
   Error: Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD for the superuser. Use
"-e POSTGRES_PASSWORD=password" to set it in "docker run".

You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections
without a password. This is *not* recommended. See PostgreSQL
documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html

我该如何解决? bitbucket-pipelines.yml文件中没有任何更改,这可能是此类错误的原因。

最佳答案

看起来原因是docker镜像的更新(github issue)。最新版本不允许在没有密码的情况下从任何地方连接到数据库。因此,您需要指定用户名/密码:

definitions:
services:
postgres:
image: postgres:9.6-alpine
environment:
POSTGRES_DB: pipelines
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_user_password

或者,如果您仍然不想使用密码,则可以设置 POSTGRES_HOST_AUTH_METHOD=trust环境变量:
definitions:
services:
postgres:
image: postgres:9.6-alpine
environment:
POSTGRES_HOST_AUTH_METHOD: trust

关于postgresql - PostgreSQL的CI/CD管道失败,出现 “Database is uninitialized and superuser password is not specified”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60262635/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com