I am encountering issues with connecting to a postgres database hosted in docker on localhost using the default port 5432
. Both pgAdmin4 and TypeORM are giving me an "invalid password" error when attempting to connect. Here is the content of my docker-compose.yml
file:
version: '3.8'
services:
db:
image: postgres
volumes:
- ./pgdata:/var/lib/postgresql/data
ports:
- '5432:5432'
environment:
POSTGRES_DB: maindb
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
Despite providing the correct credentials, I am unable to establish a connection via pgAdmin4 or TypeORM. The error message indicating "password authentication failed for user "admin"" has left me puzzled. Even after double-checking the environment variables passed through Docker Desktop, the issue persists.
If anyone could shed light on why this authentication failure is occurring with PostgreSQL in a Docker setting, it would be greatly appreciated. Alternatively, I may need to explore switching to a different database provider?
Edit 1
Below are the logs from the database startup process:
Attaching to backend_db_1
// Log entries omitted for brevity...
db_1 | 2020-08-12 09:26:50.984 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2020-08-12 09:26:50.984 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2020-08-12 09:26:50.997 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2020-08-12 09:26:51.051 UTC [66] LOG: database system was shut down at 2020-08-12 09:26:50 UTC
db_1 | 2020-08-12 09:26:51.080 UTC [1] LOG: database system is ready to accept connections