我正在使用docker运行Postgres映像。过去,它可以在Windows10和Ubuntu 18.04上正常运行。
在Ubuntu系统上重新克隆项目后,运行password authentication failed for user "postgres"
后它给我docker-compose up
错误。
它在重新安装Ubuntu系统上的项目之前曾经运行没有问题,并且在Windows10系统上仍然没有问题。
我的docker-compose.yml
:
version: '2'
services:
postgresql:
image: 'bitnami/postgresql:latest'
ports:
- '5432:5432'
environment:
- POSTGRESQL_USERNAME=someuser
- POSTGRESQL_PASSWORD=mysecretpassword
- POSTGRESQL_DATABASE=mydatabase
我尝试sudo docker system prune
删除所有停止的容器及其未使用的网络。这不能解决问题。
我需要更改/执行什么操作,以便Postgres映像能够再次在Ubuntu系统上成功运行?
完整错误:
postgresql_1 | nami INFO Initializing postgresql
postgresql_1 | postgre INFO ==> No injected postgresql.conf file found.
Creating default postgresql.conf file...
postgresql_1 | postgre INFO ==> No injected pg_hba.conf file found. Creating default pg_hba.conf file...
postgresql_1 | postgre INFO ==> Deploying PostgreSQL from scratch...
postgresql_1 | postgre INFO ==> Creating database mydatabase...
postgresql_1 | postgre INFO ==> Creating user "someuser"...
postgresql_1 | postgre INFO ==> Granting access to "someuser" to the database mydatabase...
postgresql_1 | postgre INFO ==> Configuring PostgreSQL...
postgresql_1 | postgre INFO ==> Configuring replication parameters...
postgresql_1 | postgre INFO ==> Configuring permissions for config files...
postgresql_1 | postgre INFO
postgresql_1 | postgre INFO
########################################################################
postgresql_1 | postgre INFO Installation parameters for postgresql:
postgresql_1 | postgre INFO User: someuser
postgresql_1 | postgre INFO Password: ***************
postgresql_1 | postgre INFO Database: mydatabase
postgresql_1 | postgre INFO (Passwords are not shown for security reasons)
postgresql_1 | postgre INFO
########################################################################
postgresql_1 | postgre INFO
postgresql_1 | nami INFO postgresql successfully initialized
postgresql_1 | INFO ==> Starting postgresql...
postgresql_1 | 2019-04-15 09:31:18.582 GMT [125] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgresql_1 | 2019-04-15 09:31:18.583 GMT [125] LOG: listening on IPv6 address "::", port 5432
postgresql_1 | 2019-04-15 09:31:18.587 GMT [125] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
postgresql_1 | 2019-04-15 09:31:18.599 GMT [132] LOG: database system was shut down at 2019-04-15 09:31:18 GMT
postgresql_1 | 2019-04-15 09:31:18.603 GMT [125] LOG: database system is ready to accept connections
postgresql_1 | 2019-04-15 09:31:24.414 GMT [139] FATAL: password authentication failed for user "postgres"
postgresql_1 | 2019-04-15 09:31:24.414 GMT [139] DETAIL: User "postgres" has no password assigned.
postgresql_1 | Connection matched pg_hba.conf line 95: "host all all 0.0.0.0/0 md5"
postgresql_1 | 2019-04-15 09:31:27.492 GMT [140] FATAL: password authentication failed for user "postgres"
postgresql_1 | 2019-04-15 09:31:27.492 GMT [140] DETAIL: User "postgres" has no password assigned.
答案 0 :(得分:0)
如果您查看docker映像(https://hub.docker.com/r/bitnami/postgresql)的文档,则表示您设置POSTGRESQL_USERNAME
时,postgres用户将不会分配密码,您将无法使用它登录数据库。
使用您指定的用户。