I'm trying to run pgadmin and postgres on docker. both services seems to work. However to able to connect to postgres through pgadmin. return password incorrect even after typing the password you see in the docker-compose file.
docker-compose
services:
postgres:
container_name: postgres
image: postgres
environment:
POSTGRES_USER: danny329
POSTGRES_PASSWORD: danny329
PGDATA: /data/postgres
volumes:
- postgres:/data/postgres
ports:
- "5432:5432"
networks:
- postgres
restart: unless-stopped
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: 'False'
volumes:
- pgadmin:/var/lib/pgadmin
ports:
- "5050:80"
networks:
- postgres
restart: unless-stopped
networks:
postgres:
driver: bridge
volumes:
postgres:
pgadmin:
Error screenshot:
Note: the password i used is 'danny329'
CodePudding user response:
Since both your postgres container and pgadmin container are running on the same Docker bridge network, you can connect them to each other using thier container name. For more info see