[英]Authentication error when connecting to Postgres in a Docker container
I'm getting the following error when I try to connect to a Postgres database inside a Docker container. 当我尝试连接到Docker容器内的Postgres数据库时,我收到以下错误。 I'm using pgAdmin 4 on windows as my client.
我在Windows上使用pgAdmin 4作为我的客户端。
Password does not match for user "postgres".
My docker-compose file is as follows: 我的docker-compose文件如下:
version: "3"
services:
db:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
- "5433:5432"
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
Not sure what I'm doing wrong. 不知道我做错了什么。 The file states that the username and password are both
postgres
. 该文件指出用户名和密码都是
postgres
。 I was able to connect when I just docker run
the image. 当我只是
docker run
图像时,我能够连接。 Now I'm using the compose file I seem to be getting this problem. 现在我正在使用compose文件,我似乎遇到了这个问题。
Fixed by doing the following: 通过执行以下操作来修复:
Volume must have contained previous configuration. 卷必须包含先前的配置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.