Unable to connect docker postgres

I have created a container with the following Postgres db but when I try to connect to it using pgcli I get this error.

PS C:\Users\muham> pgcli -h localhost -p 5432 -u root -d ny_taxi
Password for root:
connection failed: FATAL:  password authentication failed for user "root"
docker run -it -e POSTGRES_USER="root" -e POSTGRES_PASSWORD="root" -e POSTGRES_DB="ny_taxi" -v /f/DataEngieering_Zoomcamp/2_docker_sql/ny_taxi_postgres_data:/var/lib/postgresql/data -p 5432:5432  postgres:13
  

PS C:\Users\muham> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9c3591ae1980 postgres:13 “docker-entrypoint.s…” 22 minutes ago Up 22 minutes 0.0.0.0:5432->5432/tcp blissful_hodgkin

I even tried to connect the container from Docker Desktop Application. Facing this error.


Any points is appreciated.

I am getting the same error. were you able to resolve it ?

If you have postgresql and pgadmin installed. Try uninstalling them and try the command again. It worked for me.