首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dockerising /凤凰应用程序:(Postgrex.Error)致命28P01 (invalid_password)用户"postgres“密码身份验证失败

Dockerising /凤凰应用程序:(Postgrex.Error)致命28P01 (invalid_password)用户"postgres“密码身份验证失败
EN

Stack Overflow用户
提问于 2020-04-14 12:43:38
回答 1查看 1.1K关注 0票数 0

在PostgreSQL支持下,我在本地开发了一个药剂/凤凰应用程序。当我使用mix phx.server通过termainal运行时,一切都很好。

我现在正在尝试修改应用程序,以便可以部署到AWS。我正在使用蒸馏器跟踪与码头一起部署文档。

我已经逐字复制了该页面中的所有设置,所以在我使用相同的设置时,可以随意查看这些设置。

当我尝试运行docker-compose up时,我会得到以下错误:

代码语言:javascript
复制
...

db_1   |    Connection matched pg_hba.conf line 95: "host all all all md5"
web_1  | 12:05:31.631 [error] Postgrex.Protocol (#PID<0.1879.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
db_1   | 2020-04-14 12:05:32.093 UTC [54] FATAL:  password authentication failed for user "postgres"
db_1   | 2020-04-14 12:05:32.093 UTC [54] DETAIL:  Password does not match for user "postgres".
db_1   |    Connection matched pg_hba.conf line 95: "host all all all md5"
web_1  | 12:05:32.094 [error] Postgrex.Protocol (#PID<0.1877.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
db_1   | 2020-04-14 12:05:32.295 UTC [55] FATAL:  password authentication failed for user "postgres"
db_1   | 2020-04-14 12:05:32.295 UTC [55] DETAIL:  Password does not match for user "postgres".
db_1   |    Connection matched pg_hba.conf line 95: "host all all all md5"
web_1  | 12:05:32.296 [error] Postgrex.Protocol (#PID<0.1870.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
db_1   | 2020-04-14 12:05:32.640 UTC [56] FATAL:  password authentication failed for user "postgres"
db_1   | 2020-04-14 12:05:32.640 UTC [56] DETAIL:  Password does not match for user "postgres".
db_1   |    Connection matched pg_hba.conf line 95: "host all all all md5"
web_1  | 12:05:32.641 [error] Postgrex.Protocol (#PID<0.1880.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
db_1   | 2020-04-14 12:05:33.150 UTC [57] FATAL:  password authentication failed for user "postgres"
db_1   | 2020-04-14 12:05:33.150 UTC [57] DETAIL:  Password does not match for user "postgres".
db_1   |    Connection matched pg_hba.conf line 95: "host all all all md5"
web_1  | 12:05:33.151 [error] Postgrex.Protocol (#PID<0.1875.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
...

这可能是一个相当简单的问题,但我还没有做太多的数据库管理。我的猜测是我需要修改config/docker.env文件中的一些内容(从上面的链接)。

如果我没有弄错postgres用户的默认密码是空的。但我不知道如何使用该docker.env文件设置空白密码。理想情况下,我希望在码头的构建过程中自己设置用户名和密码,这样我就知道创建了什么用户等等(假设这样做是明智的)。

如有任何建议,将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2020-04-14 16:36:55

您发布的链接使用了标准的邮政码头形象

您可以通过设置环境变量来扩展/配置此映像。

最突出的是:

  • POSTGRES_PASSWORD
  • POSTGRES_USER
  • POSTGRES_DB

您发布的config/docker.env也使用环境变量--但只用于配置应用程序--而不是使用Postgres映像。此设置默认假定来自postgres:10-alpine的默认值。

您可以添加Postgres理解并使用现有应用程序配置的env。

为了使它与自己选择的用户名和密码一起工作。这应足以:

config/docker.env

代码语言:javascript
复制
# ...
DATABASE_USER=dbsuperuser
DATABASE_PASS=dbsuperuserpassword
POSTGRES_PASSWORD=dbsuperuserpassword
POSTGRES_USER=dbsuperuser
# ...

警告:使用环境变量配置的用户和密码是超级用户。这不应该是应用程序连接到数据库事件的用户,尽管本教程促进了这一点。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61207997

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档