Hi Everyone, so I am trying to run a docker compose file, in my app which spins up multiple containers, out of which one is a postgres instance.
Now I want to connect to this postgres instance, through my host machine’s (Windows) pgAdmin, but whenever I try connecting I get the following issue:
Unable to connect to server:
connection failed: connection to server at "127.0.0.1", port 5432 failed: FATAL: password authentication failed for user "test_postgres_user"
The configuration I used on pgAdmin is:
and ssl is disabled for the same.
This is my .env file:
DEPLOYMENT='local'
POSTGRES_DB=test_postgres_db
POSTGRES_USER=test_postgres_user
POSTGRES_PASSWORD=changeme
POSTGRES_HOST=test_postgres_db
NODE_ENV=development
And this is my docker.compose file
version: ‘3.8’
services:
test_postgres_db:
image: postgres:14-alpine
env_file: .env
environment:
- POSTGRES_DB=test_postgres_db
- POSTGRES_USER=test_postgres_user
- POSTGRES_PASSWORD=changeme
container_name: test_postgres_db
ports:
- 5432:5432
networks:
- test_network
My Docker ps
b5c2a6d86fde postgres:14-alpine test_postgres_db "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:5432->5432/tcp, [::]:5432->5432/tcp
And when I try running : docker exec -it test_postgres_db psql -U test_postgres_user -d test_postgres_db
I am able to access the postgres container.
Furthermore, I have even done docker inspect containerId
, and tried connecting through the ipaddress given in the info, but then the issue changes to
Unable to connect to server connection timed out
Now can anyone tell me what is going wrong , and how can I connect to the same?
It is vital I get it working rn, cause I am unable to test stuff and its hampering development
PS I am on windows, if that helps
Thank you