0

I start PostgreSQL 14.4 in a simple container in an own network (no brigde mode):

  postgres:
    image: postgres:14.4
    volumes:
          - /var/data_comm/postgresql:/var/lib/postgresql/data
    mem_limit: 512m
    environment:
      - POSTGRES_PASSWORD=xxxxxx
      - POSTGRES_USER=alfresco
      - POSTGRES_DB=alfresco
    command: postgres -c max_connections=300 -c log_min_messages=LOG
    ports:
      - "5432:5432"

And the database seems to be working, but in the logs the following error message repeats every 20 seconds:

        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-11-30 08:13:59.747 UTC [6307] FATAL:  password authentication failed for user "postgres"
2022-11-30 08:13:59.747 UTC [6307] DETAIL:  Role "postgres" does not exist.

I set the log level to debug1 and then I get:

2022-11-30 08:17:35.553 UTC [5842] DEBUG:  autovacuum: processing database "alfresco"
2022-11-30 08:17:39.009 UTC [5843] FATAL:  password authentication failed for user "postgres"
2022-11-30 08:17:39.009 UTC [5843] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-11-30 08:17:59.081 UTC [5844] FATAL:  password authentication failed for user "postgres"
2022-11-30 08:17:59.081 UTC [5844] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-11-30 08:18:03.733 UTC [5845] DEBUG:  autovacuum: processing database "postgres"
2022-11-30 08:18:19.156 UTC [5846] FATAL:  password authentication failed for user "postgres"
2022-11-30 08:18:19.156 UTC [5846] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-11-30 08:18:35.583 UTC [5847] DEBUG:  autovacuum: processing database "alfresco"
2022-11-30 08:18:39.239 UTC [5848] FATAL:  password authentication failed for user "postgres"
2022-11-30 08:18:39.239 UTC [5848] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-11-30 08:18:59.283 UTC [5849] FATAL:  password authentication failed for user "postgres"
2022-11-30 08:18:59.283 UTC [5849] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-11-30 08:19:03.759 UTC [5850] DEBUG:  autovacuum: processing database "postgres"
2022-11-30 08:19:19.370 UTC [5851] FATAL:  password authentication failed for user "postgres"
2022-11-30 08:19:19.370 UTC [5851] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"

The content of pg_hba.conf (default from the container image) is

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust

host all all all scram-sha-256

There is no cron job in this container for PostgreSQL.

As I mentioned the database seems to be working but no one wants a repeating FATAL error message in his logs ;-)

What is the reason for this behavior? And how can I fix it? Thanks for any help.

Peter Schütt

2 Answers 2

0

Try this

postgres:
    image: postgres:14.4
    volumes:
          - /var/data_comm/postgresql:/var/lib/postgresql/data
    mem_limit: 512m
    environment:
      - PGUSER: alfresco
      - POSTGRES_PASSWORD=xxxxxx
      - POSTGRES_USER=alfresco
      - POSTGRES_DB=alfresco
    command: postgres -c max_connections=300 -c log_min_messages=LOG
    ports:
      - "5432:5432"

In my case, adding this line - PGUSER: alfresco to the docker-compose file helped

0

I was getting the same error in my docker compose as well, but my setup is slightly different. I had my environment variables in a .env file rather than in the docker compose.

My env file was copied pasted from a Windows file so it had CRLF line endings. I rewrote my env file with LF line endings, restarted the docker compose, and the error no longer appears.

Is your docker compose file written with CRLF line endings? If so, try changing it to LF.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.