0

I am currently struggling to connect to a locally created postgres db. The postgres server is defined inside a docker-compose.yml like this:

version: '3.9'
services:
    postgres:
        image: bitnami/postgresql:13.4.0
        container_name: mopla-postgres
        restart: always
        environment:
            - POSTGRES_USER=mopla
            - POSTGRES_PASSWORD=develop
            - POSTGRESQL_DATABASE=mopla
        volumes:
            - mopla-postgres:/bitnami/postgresql
            - ./database_dumps:/docker-entrypoint-initdb.d
        ports:
            - 5432:5432
...

The container seems to start:

postgresql 09:02:41.34 
postgresql 09:02:41.34 Welcome to the Bitnami postgresql container
postgresql 09:02:41.34 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
postgresql 09:02:41.34 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
postgresql 09:02:41.35 
postgresql 09:02:41.36 INFO  ==> ** Starting PostgreSQL setup **
postgresql 09:02:41.39 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql 09:02:41.39 INFO  ==> Loading custom pre-init scripts...
postgresql 09:02:41.40 INFO  ==> Initializing PostgreSQL database...
postgresql 09:02:41.42 INFO  ==> pg_hba.conf file not detected. Generating it...
postgresql 09:02:41.42 INFO  ==> Generating local authentication configuration
postgresql 09:02:41.43 INFO  ==> Deploying PostgreSQL with persisted data...
postgresql 09:02:41.43 INFO  ==> Configuring replication parameters
postgresql 09:02:41.46 INFO  ==> Configuring fsync
postgresql 09:02:41.49 INFO  ==> Loading custom scripts...
postgresql 09:02:41.50 INFO  ==> Enabling remote connections
postgresql 09:02:41.51 INFO  ==> ** PostgreSQL setup finished! **
postgresql 09:02:41.55 INFO  ==> ** Starting PostgreSQL **
2022-11-28 09:02:41.571 GMT [1] LOG:  pgaudit extension initialized
2022-11-28 09:02:41.576 GMT [1] LOG:  starting PostgreSQL 13.4 on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2022-11-28 09:02:41.576 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-11-28 09:02:41.576 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2022-11-28 09:02:41.580 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-11-28 09:02:41.586 GMT [85] LOG:  database system was shut down at 2022-11-28 09:02:36 GMT
2022-11-28 09:02:41.590 GMT [1] LOG:  database system is ready to accept connections

Now, when I try to connect to this database with pgadmin with the password "develop", I get an authentication error:

enter image description here

Here is the configuration:

enter image description here

Is there anything obvious I am doing wrong? Anything I can do to debug this issue further?

2
  • What new lines get added to that log when the authentication fails? Commented Nov 28, 2022 at 12:56
  • No logs were added - but I already figured out the issue. See my answer below. Commented Nov 28, 2022 at 13:44

1 Answer 1

1

Alright, I figured it out.

There was a windows-service running that was also opening a postgres db on the same port (5432), so I was trying to connect to the wrong db.

TCPView helped me figuring out the issue.

Sign up to request clarification or add additional context in comments.

2 Comments

That makes sense on one hand, but is weird on another. For me on Linux, the port line causes the docker-compose up to fail when the port on the host is already in use. I would have expected Windows to behave the same way.
As you have guessed, I am using windows - where it did not fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.