gpt4 book ai didi

postgresql - Docker dpage/pgadmin4错误:指定的用户不存在

转载 作者:行者123 更新时间:2023-12-02 19:19:30 24 4
gpt4 key购买 nike

这是docker-compose.yml文件:

version: '3'

services:
############################
# Setup database container #
############################
postgres_db:
image: postgres
restart: always
ports:
- ${POSTGRES_PORT}:${POSTGRES_PORT}
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- ./data:/var/lib/postgresql/data
networks:
- db_network

pgadmin:
image: dpage/pgadmin4:4.19
restart: always
ports:
- 8001:8080/tcp
environment:
- PGADMIN_LISTEN_ADDRESS=0.0.0.0
- PGADMIN_LISTEN_PORT=8080
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
networks:
- db_network

networks:
db_network:
driver: bridge


在同一目录中有一个 .env文件。
# The above refers to the name of the postgres container since using docker-compose
# This is because docker-compose creates a user-defined network. Kubernetes also does this.
POSTGRES_PORT=5432
POSTGRES_USER=website
POSTGRES_PASSWORD=website
POSTGRES_DB=wikifakes_main
PGADMIN_DEFAULT_EMAIL=info@my-website.com
PGADMIN_DEFAULT_PASSWORD=my-secure-password

当执行 docker-compose up --build时,docker start和我都可以通过 localhost:8001访问pgAdmin4网站。
但是,输入凭据后,我得到以下响应:

Specified user does not exist



为什么指定的用户不存在,如何更改环境才能登录?

不过,通过 pgadmin4创建的 docker run --rm -e PGADMIN_DEFAULT_EMAIL="info@my-website.com" -e PGADMIN_DEFAULT_PASSWORD="my-secure-password" -p 8001:80 dpage/pgadmin4 docker 的登录正常。

最佳答案

在docker-compose.yml文件中将tty: true添加到pgadmin服务。


pgadmin:
image: dpage/pgadmin4:4.19
restart: always
ports:
- 8001:8080/tcp
environment:
- PGADMIN_LISTEN_ADDRESS=0.0.0.0
- PGADMIN_LISTEN_PORT=8080
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
networks:
- db_network
# ADD THIS LINE
tty: true

因此,完整的文件如下所示:

version: '3'

services:
############################
# Setup database container #
############################
postgres_db:
image: postgres
restart: always
ports:
- ${POSTGRES_PORT}:${POSTGRES_PORT}
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- ./data:/var/lib/postgresql/data
networks:
- db_network

pgadmin:
image: dpage/pgadmin4:4.19
restart: always
ports:
- 8001:8080/tcp
environment:
- PGADMIN_LISTEN_ADDRESS=0.0.0.0
- PGADMIN_LISTEN_PORT=8080
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
networks:
- db_network
# ADD THIS LINE, TO BE ABLE TO LOGIN
tty: true

networks:
db_network:
driver: bridge

关于postgresql - Docker dpage/pgadmin4错误:指定的用户不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60922488/

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