It sounds like you are having trouble connecting to the PostgreSQL server running in the Docker container. To connect to the PostgreSQL server running in the Docker container, you will need to use the IP address of the Docker container. You can find the IP address of the Docker container by running the following command:
docker inspect <container_name> | grep IPAddress
Once you have the IP address of the Docker container, you can use that IP address as the hostname/address when connecting to the PostgreSQL server.
If you are still having trouble connecting to the PostgreSQL server, you may need to check the configuration of the PostgreSQL server in the Docker container. You can do this by running the following command:
docker exec -it <container_name> psql -U <username>
This will open a psql shell in the Docker container, where you can check the configuration of the PostgreSQL server.
I hope this helps!