Hey im trying to create a postgresql db container, im running it using the command:
docker-compose up
on the following compose file:
version: '3.1'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_USERNAME: admin
POSTGRES_PASSWORD: admin
POSTGRES_DB: default_db
ports:
- 54320:5432
However when I try to connect to it using the follwoing python code:
import sqlalchemy
engine = sqlalchemy.create_engine('postgres://admin:admin@localhost:54320/default_db')
engine.connect()
I get the following error:
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: password authentication failed for user "admin"
Anyone knows why this happens?
docker exec -it <postgres-container-id> /bin/sh, and try to connect to Postgres from within the container.