I wanted to set up pgAdmin with Postgres with Docker Compose but im having some problems. After logging in to pgAdmin I get this warning when clicking the server, and entering "password123" just keep the message coming back.
The error i get: FATAL: password authentication failed for user "user".
My docker compose:
version: '2'
networks:
appnetwork:
driver: bridge
services:
postgresql:
image: 'bitnami/postgresql:latest'
ports:
- '5432'
networks:
- appnetwork
environment:
- POSTGRESQL_USERNAME=user
- POSTGRESQL_PASSWORD=password123
- POSTGRESQL_DATABASE=my_database
volumes:
- ./postgresdata:/bitnami/postgresql
pgAdmin:
image: 'dpage/pgadmin4'
ports:
- '8001:80'
networks:
- appnetwork
environment:
- PGADMIN_DEFAULT_EMAIL=admin@admin.com
- PGADMIN_DEFAULT_PASSWORD=password123
volumes:
- ./configs/pgadmin_servers.json:/pgadmin4/servers.json
- ./configs/pgpass:/var/lib/pgadmin/pgpass/pgpass
pgadmin_servers.json
{
"Servers": {
"1": {
"Name": "docker_postgres",
"Group": "Servers",
"Host": "host.docker.internal",
"Port": 5432,
"MaintenanceDB": "postgres",
"Username": "user",
"PassFile": "/var/lib/pgadmin/pgpass/pgpass",
"SSLMode": "prefer"
}
}
}
pgpass:
host.docker.internal:5432:my_database:user:password123
If I use the CLI with Docker Desktop and cd to /var/lib/pgadmin/pgpass/ on the instance running pgadmin i can cat the file and its what I've set in my config folder.