Connection failed when running a docker container using PostgreSQL/PostGIS database

Hi,
I’m new to Docker and I’m experiencing an issue regarding Connection failure to my PostgreSQL/PostGIS Database after building my container and image using Kartoza/postgis available in Docker Search bar for Windows.

This work well after running my container which connects with my database server with the credentials I set up to the PostgreSQL/PostGIS server.

But when I sign out my container and stop Docker and reopen it, Docker doesn’t recognize my password authentification I set earlier for the user I created.

The first time, that this issue occurs, I hoped that I made an mistake or forget my password. So I delete my container and image associated and reinstall Docker with a new container and image and everything works well. However, during the process of building the new container, I took a picture for remembering my credentials, username and password.

But after shutting down and rebooting my machine and running Docker, I get the same error message.

Blockquote

2025-01-20 19:03:00.531 UTC [379] user@gis FATAL: password authentication failed for user “user”
2025-01-20 14:03:00 2025-01-20 19:03:00.531 UTC [379] user@gis DETAIL: Connection matched file “/etc/postgresql/17/main/pg_hba.conf” line 133: "host all all

Blockquote

Any idea about this issue?

Regards,

Please share the exact command use to start the container, or if docker compose was used, the content of the compose file.

Hi meyay,
Thank you for your quick response. Here is the command I used to start the container:
docker start followed by the container ID. After that, I run the command docker ps which returns me the container number, the associated image, the creation date, the status, the port etc. I can see that on the status, Docker has successfully started the container. And I’m still having the error message using pgAdmin client when launching PosgreSQL/PostGIS:

connection failed: connection to server at “127.0.0.1”, port 25432 failed: FATAL: password authentication failed for user “utambta” connection to server at “127.0.0.1”, port 25432 failed: FATAL: password authentication failed for user “utambta”

IMAGE COMMAND CREATED STATUS PORTS
kartoza/postgis:latest “/bin/bash /scripts/…” 23 hours ago Up 31 seconds 0.0.0.0:25432->5432/tcp
Blockquote

Regards,

My bad, I should have been more specific:
we need to know how you create the containers. Please share the exact command, as it helps us to understand how exactly the container is created.

Hi Meyay,

Fortunately the connection issue has been resolved. I realized that a space has been added at the end of the password creation. Now I’m able to connect to my PostgreSQL/PostGIS server created by the image kartoza-postgis in my container.

Thanks for your help,

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.