我在docker php/postgres应用程序中使用phppgadmin,但我遇到了无法解决的问题登录phppgadmin并得到错误
Invalid login
我有:
version: '3'
services:
web:
build:
context: ./web
dockerfile: Dockerfile.yml
environment:
- APACHE_RUN_USER=#1000
container_name: lprods_web
volumes:
- ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
ports:
- 8086:80
working_dir: ${APP_PTH_CONTAINER}
db:
image: postgres:9.6.10-alpine
container_name: lprods_db
ports:
- '5433:5432' // THAT IS USED PORT
restart: always
environment:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: '1'
POSTGRES_DB: 'wprods' // I NEED TO CREATE THIS BD in phppgadmin
volumes:
- ./init:/docker-entrypoint-initdb.d/
phppgadmin:
image: dockage/phppgadmin:latest
environment:
- POSTGRESQL_HOST=postgres
# - POSTGRESQL_PORT=5432
- POSTGRESQL_PORT='5433:5432' // THAT IS USED PORT
- POSTGRESQL_DEFAULT_DB=postgres
container_name: lprods_phppgadmin
restart: always
ports:
- 8087:80
- "443:443"
links:
- db
我在控制台中看到:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
709b563331fc dockage/phppgadmin:latest "/sbin/entrypoint ap" About a minute ago Up About a minute 0.0.0.0:443->443/tcp, 0.0.0.0:8087->80/tcp lprods_phppgadmin
6d5df00a25be lprodsdocker_web "docker-php-entrypoi" About a minute ago Up About a minute 0.0.0.0:8086->80/tcp lprods_web
0751d16f728f postgres:9.6.10-alpine "docker-entrypoint.s" About a minute ago Up About a minute 0.0.0.0:5433->5432/tcp lprods_db
为什么我不能登录phppgadmin?我想我输入了有效的密码。我能查一下吗?
dockage/phppgadmin
的环境变量名称以及您正在设置的主机/端口值都是错误的。
你需要这样设置它们:
phppgadmin:
image: dockage/phppgadmin:latest
environment:
- PHP_PG_ADMIN_SERVER_HOST=db
- PHP_PG_ADMIN_SERVER_PORT=5432
- PHP_PG_ADMIN_SERVER_DEFAULT_DB=postgres
然后,您可以使用密码为1
的用户postgres
登录phpPgAdmin。