Postgresql Peer authentication failed for user "gitlab" when starting new Gitlab Instance

When starting the Gitlab-Docker-Image with docker stack deploy -c gitlab-compose.yml gitlab my gitlab instance is starting. Also the gitlab runners are starting. But the gitlab instance get stuck at a specific point:

        - update utime on file /opt/gitlab/service/postgresql/supervise/control
      * file[/opt/gitlab/service/postgresql/log/supervise/control] action touch
        - create new file /opt/gitlab/service/postgresql/log/supervise/control
        - change owner from '' to 'gitlab-psql'
        - change group from '' to 'gitlab-psql'
        - update utime on file /opt/gitlab/service/postgresql/log/supervise/control
      - execute the ruby block reload_log_service
    * ruby_block[restart_log_service] action run
      * ruby_block[restart_service] action nothing (skipped due to action :nothing)
      * ruby_block[restart_log_service] action nothing (skipped due to action :nothing)
      * ruby_block[reload_log_service] action nothing (skipped due to action :nothing)
      * directory[/opt/gitlab/sv/postgresql] action create (up to date)
      * template[/opt/gitlab/sv/postgresql/run] action create (up to date)
      * directory[/opt/gitlab/sv/postgresql/log] action create (up to date)
      * directory[/opt/gitlab/sv/postgresql/log/main] action create (up to date)
      * template[/opt/gitlab/sv/postgresql/log/config] action create (up to date)
      * ruby_block[verify_chown_persisted_on_postgresql] action nothing (skipped due to action :nothing)
      * link[/var/log/gitlab/postgresql/config] action create (up to date)
      * template[/opt/gitlab/sv/postgresql/log/run] action create (up to date)
      * directory[/opt/gitlab/sv/postgresql/env] action create (up to date)
      * ruby_block[Delete unmanaged env files for postgresql service] action run (skipped due to only_if)
      * template[/opt/gitlab/sv/postgresql/check] action create (skipped due to only_if)
      * template[/opt/gitlab/sv/postgresql/finish] action create (skipped due to only_if)
      * directory[/opt/gitlab/sv/postgresql/control] action create (up to date)
      * template[/opt/gitlab/sv/postgresql/control/t] action create (up to date)
      * link[/opt/gitlab/init/postgresql] action create (up to date)
      * file[/opt/gitlab/sv/postgresql/down] action nothing (skipped due to action :nothing)
      * directory[/opt/gitlab/service] action create (up to date)
      * link[/opt/gitlab/service/postgresql] action create (up to date)
      * ruby_block[wait for postgresql service socket] action run (skipped due to not_if)
      * directory[/opt/gitlab/service/postgresql/supervise] action create (up to date)
      * directory[/opt/gitlab/service/postgresql/log/supervise] action create (up to date)
      * file[/opt/gitlab/service/postgresql/supervise/ok] action touch (skipped due to only_if)
      * file[/opt/gitlab/service/postgresql/log/supervise/ok] action touch (skipped due to only_if)
      * file[/opt/gitlab/service/postgresql/supervise/status] action touch (skipped due to only_if)
      * file[/opt/gitlab/service/postgresql/log/supervise/status] action touch
        - change owner from 'root' to 'gitlab-psql'
        - change group from 'root' to 'gitlab-psql'
        - update utime on file /opt/gitlab/service/postgresql/log/supervise/status
      * file[/opt/gitlab/service/postgresql/supervise/control] action touch (skipped due to only_if)
      * file[/opt/gitlab/service/postgresql/log/supervise/control] action touch (skipped due to only_if)
      - execute the ruby block restart_log_service
    * directory[/opt/gitlab/service] action create (up to date)
    * link[/opt/gitlab/service/postgresql] action create (up to date)
    * ruby_block[wait for postgresql service socket] action run (skipped due to not_if)
    * directory[/opt/gitlab/service/postgresql/supervise] action create (up to date)
    * directory[/opt/gitlab/service/postgresql/log/supervise] action create (up to date)
    * file[/opt/gitlab/service/postgresql/supervise/ok] action touch (skipped due to only_if)
    * file[/opt/gitlab/service/postgresql/log/supervise/ok] action touch (skipped due to only_if)
    * file[/opt/gitlab/service/postgresql/supervise/status] action touch (skipped due to only_if)
    * file[/opt/gitlab/service/postgresql/log/supervise/status] action touch
      - change owner from 'root' to 'gitlab-psql'
      - change group from 'root' to 'gitlab-psql'
      - update utime on file /opt/gitlab/service/postgresql/log/supervise/status
    * file[/opt/gitlab/service/postgresql/supervise/control] action touch (skipped due to only_if)
    * file[/opt/gitlab/service/postgresql/log/supervise/control] action touch (skipped due to only_if)
  * execute[/opt/gitlab/bin/gitlab-ctl start postgresql] action run
    [execute] ok: run: postgresql: (pid 421) 4s
    - execute /opt/gitlab/bin/gitlab-ctl start postgresql
  * database_objects[postgresql] action create
    * postgresql_user[gitlab] action create
      * execute[create gitlab postgresql user] action run (skipped due to not_if)
       (up to date)
    * postgresql_user[gitlab_replicator] action create
      * execute[create gitlab_replicator postgresql user] action run (skipped due to not_if)
      * execute[set options for gitlab_replicator postgresql user] action run (skipped due to not_if)
       (up to date)
    * postgresql_database[gitlabhq_production] action create
      * execute[create database gitlabhq_production] action run (skipped due to not_if)
       (up to date)
    * postgresql_extension[pg_trgm] action enable
      * postgresql_query[enable pg_trgm extension] action run (skipped due to only_if)
       (up to date)
    * postgresql_extension[btree_gist] action enable
      * postgresql_query[enable btree_gist extension] action run (skipped due to only_if)
       (up to date)
     (up to date)
  * ruby_block[warn pending postgresql restart] action run (skipped due to only_if)
  * execute[reload postgresql] action nothing (skipped due to action :nothing)
  * execute[start postgresql] action nothing (skipped due to action :nothing)
Recipe: praefect::disable
  * service[praefect] action nothing (skipped due to action :nothing)
  * runit_service[praefect] action disable
    * ruby_block[disable praefect] action run (skipped due to only_if)
     (up to date)
  * consul_service[praefect] action delete
    * file[/var/opt/gitlab/consul/config.d/praefect-service.json] action delete (up to date)
     (up to date)
Recipe: gitlab-kas::disable
  * service[gitlab-kas] action nothing (skipped due to action :nothing)
  * runit_service[gitlab-kas] action disable
    * ruby_block[disable gitlab-kas] action run (skipped due to only_if)
     (up to date)
Recipe: gitlab::database_migrations
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
  * rails_migration[gitlab-rails] action run
    * bash[migrate gitlab-rails database] action run
      [execute] psql:/opt/gitlab/embedded/service/gitlab-rails/db/structure.sql:9: NOTICE:  extension "btree_gist" already exists, skipping
                psql:/opt/gitlab/embedded/service/gitlab-rails/db/structure.sql:11: NOTICE:  extension "pg_trgm" already exists, skipping

I dont get any error-message. It just stucks there and then after some time the container gets shut down and a new container is started.

Then I inspected the recovery logs:

# Logfile created on 2021-08-29 09:47:40 +0000 by logger.rb/v1.4.2
[2021-08-29T09:47:40+00:00] INFO: Started Chef Infra Zero at chefzero://localhost:1 with repository at /opt/gitlab/embedded
  One version per cookbook
...
[2021-08-29T09:48:14+00:00] INFO: template[/opt/gitlab/sv/gitaly/log/config] sending create action to ruby_block[reload_log_service] (delayed)
[2021-08-29T09:48:14+00:00] INFO: link[/opt/gitlab/service/gitaly] created
[2021-08-29T09:48:16+00:00] INFO: ruby_block[wait for gitaly service socket] called
[2021-08-29T09:48:17+00:00] INFO: ruby_block[reload_log_service] called
[2021-08-29T09:48:17+00:00] INFO: template[/opt/gitlab/sv/gitaly/log/run] sending run action to ruby_block[restart_log_service] (delayed)
[2021-08-29T09:48:17+00:00] INFO: ruby_block[restart_log_service] called
[2021-08-29T09:48:20+00:00] INFO: execute[/opt/gitlab/bin/gitlab-ctl start gitaly] ran successfully
[2021-08-29T09:48:20+00:00] INFO: file[/var/opt/gitlab/gitaly/VERSION] created file /var/opt/gitlab/gitaly/VERSION
[2021-08-29T09:48:20+00:00] INFO: file[/var/opt/gitlab/gitaly/VERSION] updated file contents /var/opt/gitlab/gitaly/VERSION
[2021-08-29T09:48:20+00:00] INFO: file[/var/opt/gitlab/gitaly/RUBY_VERSION] created file /var/opt/gitlab/gitaly/RUBY_VERSION
[2021-08-29T09:48:20+00:00] INFO: file[/var/opt/gitlab/gitaly/RUBY_VERSION] updated file contents /var/opt/gitlab/gitaly/RUBY_VERSION
[2021-08-29T09:48:20+00:00] INFO: version_file[Create Ruby version file for Gitaly] not queuing delayed action hup on runit_service[gitaly] (delayed), as it's already been queued
[2021-08-29T09:48:20+00:00] INFO: ruby_block[Link postgresql bin files to the correct version] called
[2021-08-29T09:48:20+00:00] INFO: template[/opt/gitlab/etc/gitlab-psql-rc] created file /opt/gitlab/etc/gitlab-psql-rc
[2021-08-29T09:48:20+00:00] INFO: template[/opt/gitlab/etc/gitlab-psql-rc] updated file contents /opt/gitlab/etc/gitlab-psql-rc
[2021-08-29T09:48:20+00:00] INFO: template[/opt/gitlab/etc/gitlab-psql-rc] owner changed to 0
[2021-08-29T09:48:20+00:00] INFO: template[/opt/gitlab/etc/gitlab-psql-rc] group changed to 0
[2021-08-29T09:48:20+00:00] INFO: directory[/var/opt/gitlab/postgresql] created directory /var/opt/gitlab/postgresql
[2021-08-29T09:48:20+00:00] INFO: directory[/var/opt/gitlab/postgresql] owner changed to 996
[2021-08-29T09:48:20+00:00] INFO: directory[/var/opt/gitlab/postgresql] mode changed to 755
[2021-08-29T09:48:20+00:00] INFO: file[/var/opt/gitlab/postgresql/.profile] created file /var/opt/gitlab/postgresql/.profile
[2021-08-29T09:48:20+00:00] INFO: file[/var/opt/gitlab/postgresql/.profile] updated file contents /var/opt/gitlab/postgresql/.profile
[2021-08-29T09:48:20+00:00] INFO: file[/var/opt/gitlab/postgresql/.profile] owner changed to 996
[2021-08-29T09:48:20+00:00] INFO: file[/var/opt/gitlab/postgresql/.profile] mode changed to 600
[2021-08-29T09:48:20+00:00] INFO: directory[/var/opt/gitlab/postgresql/data] created directory /var/opt/gitlab/postgresql/data
[2021-08-29T09:48:20+00:00] INFO: directory[/var/opt/gitlab/postgresql/data] owner changed to 996
[2021-08-29T09:48:20+00:00] INFO: directory[/var/opt/gitlab/postgresql/data] mode changed to 700
[2021-08-29T09:48:20+00:00] INFO: directory[/var/log/gitlab/postgresql] created directory /var/log/gitlab/postgresql
[2021-08-29T09:48:20+00:00] INFO: directory[/var/log/gitlab/postgresql] owner changed to 996
[2021-08-29T09:48:20+00:00] INFO: directory[/var/log/gitlab/postgresql] mode changed to 700
[2021-08-29T09:48:26+00:00] INFO: execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] ran successfully
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.crt] created file /var/opt/gitlab/postgresql/data/server.crt
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.crt] updated file contents /var/opt/gitlab/postgresql/data/server.crt
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.crt] owner changed to 996
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.crt] group changed to 996
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.crt] mode changed to 400
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.key] created file /var/opt/gitlab/postgresql/data/server.key
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.key] updated file contents /var/opt/gitlab/postgresql/data/server.key
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.key] owner changed to 996
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.key] group changed to 996
[2021-08-29T09:48:26+00:00] INFO: file[/var/opt/gitlab/postgresql/data/server.key] mode changed to 400
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/postgresql.conf] backed up to /opt/gitlab/embedded/cookbooks/cache/backup/var/opt/gitlab/postgresql/data/postgresql.conf.chef-20210829094826.388684
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/postgresql.conf] updated file contents /var/opt/gitlab/postgresql/data/postgresql.conf
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/postgresql.conf] mode changed to 644
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/runtime.conf] created file /var/opt/gitlab/postgresql/data/runtime.conf
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/runtime.conf] updated file contents /var/opt/gitlab/postgresql/data/runtime.conf
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/runtime.conf] owner changed to 996
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/runtime.conf] mode changed to 644
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/pg_hba.conf] backed up to /opt/gitlab/embedded/cookbooks/cache/backup/var/opt/gitlab/postgresql/data/pg_hba.conf.chef-20210829094826.482744
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/pg_hba.conf] updated file contents /var/opt/gitlab/postgresql/data/pg_hba.conf
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/pg_hba.conf] mode changed to 644
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/pg_ident.conf] backed up to /opt/gitlab/embedded/cookbooks/cache/backup/var/opt/gitlab/postgresql/data/pg_ident.conf.chef-20210829094826.510930
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/pg_ident.conf] updated file contents /var/opt/gitlab/postgresql/data/pg_ident.conf
[2021-08-29T09:48:26+00:00] INFO: template[/var/opt/gitlab/postgresql/data/pg_ident.conf] mode changed to 644
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql] created directory /opt/gitlab/sv/postgresql
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql] mode changed to 755
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/run] created file /opt/gitlab/sv/postgresql/run
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/run] updated file contents /opt/gitlab/sv/postgresql/run
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/run] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/run] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/run] mode changed to 755
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/log] created directory /opt/gitlab/sv/postgresql/log
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/log] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/log] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/log] mode changed to 755
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/log/main] created directory /opt/gitlab/sv/postgresql/log/main
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/log/main] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/log/main] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/log/main] mode changed to 755
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/config] created file /opt/gitlab/sv/postgresql/log/config
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/config] updated file contents /opt/gitlab/sv/postgresql/log/config
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/config] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/config] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/config] mode changed to 644
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/config] sending create action to ruby_block[verify_chown_persisted_on_postgresql] (immediate)
[2021-08-29T09:48:26+00:00] INFO: ruby_block[verify_chown_persisted_on_postgresql] called
[2021-08-29T09:48:26+00:00] INFO: link[/var/log/gitlab/postgresql/config] created
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/run] created file /opt/gitlab/sv/postgresql/log/run
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/run] updated file contents /opt/gitlab/sv/postgresql/log/run
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/run] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/run] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/run] mode changed to 755
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/env] created directory /opt/gitlab/sv/postgresql/env
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/env] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/env] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/env] mode changed to 755
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/control] created directory /opt/gitlab/sv/postgresql/control
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/control] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/control] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: directory[/opt/gitlab/sv/postgresql/control] mode changed to 755
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/control/t] created file /opt/gitlab/sv/postgresql/control/t
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/control/t] updated file contents /opt/gitlab/sv/postgresql/control/t
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/control/t] owner changed to 0
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/control/t] group changed to 0
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/control/t] mode changed to 755
[2021-08-29T09:48:26+00:00] INFO: link[/opt/gitlab/init/postgresql] created
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/run] sending run action to ruby_block[restart_service] (delayed)
[2021-08-29T09:48:26+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/config] sending create action to ruby_block[reload_log_service] (delayed)
[2021-08-29T09:48:26+00:00] INFO: link[/opt/gitlab/service/postgresql] created
[2021-08-29T09:48:28+00:00] INFO: ruby_block[wait for postgresql service socket] called
[2021-08-29T09:48:28+00:00] INFO: directory[/opt/gitlab/service/postgresql/supervise] mode changed to 755
[2021-08-29T09:48:28+00:00] INFO: directory[/opt/gitlab/service/postgresql/log/supervise] mode changed to 755
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/ok] created file /opt/gitlab/service/postgresql/supervise/ok
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/ok] owner changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/ok] group changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/ok] updated atime and mtime to 2021-08-29 09:48:28 +0000
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/ok] created file /opt/gitlab/service/postgresql/log/supervise/ok
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/ok] owner changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/ok] group changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/ok] updated atime and mtime to 2021-08-29 09:48:28 +0000
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/status] owner changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/status] group changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/status] updated atime and mtime to 2021-08-29 09:48:28 +0000
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] owner changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] group changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] updated atime and mtime to 2021-08-29 09:48:28 +0000
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/control] created file /opt/gitlab/service/postgresql/supervise/control
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/control] owner changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/control] group changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/supervise/control] updated atime and mtime to 2021-08-29 09:48:28 +0000
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/control] created file /opt/gitlab/service/postgresql/log/supervise/control
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/control] owner changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/control] group changed to 996
[2021-08-29T09:48:28+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/control] updated atime and mtime to 2021-08-29 09:48:28 +0000
[2021-08-29T09:48:29+00:00] INFO: ruby_block[reload_log_service] called
[2021-08-29T09:48:29+00:00] INFO: template[/opt/gitlab/sv/postgresql/log/run] sending run action to ruby_block[restart_log_service] (delayed)
[2021-08-29T09:48:29+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] owner changed to 996
[2021-08-29T09:48:29+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] group changed to 996
[2021-08-29T09:48:29+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] updated atime and mtime to 2021-08-29 09:48:29 +0000
[2021-08-29T09:48:29+00:00] INFO: ruby_block[restart_log_service] called
[2021-08-29T09:48:29+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] owner changed to 996
[2021-08-29T09:48:29+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] group changed to 996
[2021-08-29T09:48:29+00:00] INFO: file[/opt/gitlab/service/postgresql/log/supervise/status] updated atime and mtime to 2021-08-29 09:48:29 +0000
[2021-08-29T09:48:31+00:00] INFO: execute[/opt/gitlab/bin/gitlab-ctl start postgresql] ran successfully
[2021-08-29T09:48:31+00:00] INFO: execute[create gitlab postgresql user] ran successfully
[2021-08-29T09:48:31+00:00] INFO: execute[create gitlab_replicator postgresql user] ran successfully
[2021-08-29T09:48:32+00:00] INFO: execute[set options for gitlab_replicator postgresql user] ran successfully
[2021-08-29T09:48:34+00:00] INFO: execute[create database gitlabhq_production] ran successfully
[2021-08-29T09:48:35+00:00] INFO: execute[enable pg_trgm extension (postgresql)] ran successfully
[2021-08-29T09:48:35+00:00] INFO: execute[enable btree_gist extension (postgresql)] ran successfully

But the only thing I can see, is that everything has worked. I also had a look into the postgresql logs:

2021-08-29_09:48:27.94088 LOG:  starting PostgreSQL 12.6 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
2021-08-29_09:48:28.01483 LOG:  listening on Unix socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"
2021-08-29_09:48:28.38208 LOG:  database system was shut down at 2021-08-29 09:48:21 GMT
2021-08-29_09:48:28.56837 LOG:  database system is ready to accept connections
2021-08-29_09:48:31.58368 LOG:  no match in usermap "gitlab" for user "gitlab" authenticated as "root"
2021-08-29_09:48:31.58380 FATAL:  Peer authentication failed for user "gitlab"
2021-08-29_09:48:31.58380 DETAIL:  Connection matched pg_hba.conf line 70: "local   all         all                               peer map=gitlab"
2021-08-29_09:48:31.79085 LOG:  no match in usermap "gitlab" for user "gitlab" authenticated as "root"
2021-08-29_09:48:31.79089 FATAL:  Peer authentication failed for user "gitlab"
2021-08-29_09:48:31.79089 DETAIL:  Connection matched pg_hba.conf line 70: "local   all         all                               peer map=gitlab"
2021-08-29_09:48:31.96417 LOG:  no match in usermap "gitlab" for user "gitlab" authenticated as "root"
2021-08-29_09:48:31.96421 FATAL:  Peer authentication failed for user "gitlab"
2021-08-29_09:48:31.96422 DETAIL:  Connection matched pg_hba.conf line 70: "local   all         all                               peer map=gitlab"
2021-08-29_09:48:34.81977 LOG:  no match in usermap "gitlab" for user "gitlab" authenticated as "root"
2021-08-29_09:48:34.82072 FATAL:  Peer authentication failed for user "gitlab"
2021-08-29_09:48:34.82073 DETAIL:  Connection matched pg_hba.conf line 70: "local   all         all                               peer map=gitlab"
2021-08-29_09:48:35.14719 LOG:  no match in usermap "gitlab" for user "gitlab" authenticated as "root"
2021-08-29_09:48:35.14722 FATAL:  Peer authentication failed for user "gitlab"
2021-08-29_09:48:35.14723 DETAIL:  Connection matched pg_hba.conf line 70: "local   all         all                               peer map=gitlab"

So it seems that something with the users is wrong? The problem is, that I cant really change that much in the Dockerfile, can I? Here is my gitlab-compose.yml:

version: "3.8"
services:
  gitlab:
    image: gitlab/gitlab-ce:14.2.1-ce.0
    networks:
      - default
    ports:
      - "22:22"
      - "10443:10443"
    volumes:
      - $GITLAB_DATA/data:/var/opt/gitlab
      - $GITLAB_DATA/logs:/var/log/gitlab
      - $GITLAB_DATA/config:/etc/gitlab
    environment:
      GITLAB_OMNIBUS_CONFIG: "from_file('/omnibus_config.rb')"
    configs:
      - source: gitlab
        target: /omnibus_config.rb
    secrets:
      - gitlab_root_password
    deploy:
      labels:
        caddy: gitlab.mydomain.de
        caddy.reverse_proxy: "{{ upstreams 10443}}"
        caddy.reverse_proxy.header_up: X-Forwarded-Ssl on
        caddy.reverse_proxy.fail_duration: 0s
      placement:
        constraints:
          - node.role == manager
      replicas: 1
      restart_policy:
        condition: any
  gitlab-runner:
    image: gitlab/gitlab-runner:alpine
    deploy:
      mode: replicated
      replicas: 4
      placement:
        constraints:
          - node.role == worker

configs:
  gitlab:
    file: ./gitlab.rb

secrets:
  gitlab_root_password:
    file: ./root_password.txt

networks:
  default:
    external: true
    name: caddy

Also the corresponding gitlab.rb

external_url 'https://gitlab.mydomain.de:10443'
gitlab_rails['initial_root_password'] = File.read('/run/secrets/gitlab_root_password')

Does anyone know how to solve this problem and get it to work properly?

The executing system is:
Ubuntu server 20.04.3 LTS
Intel Core 2 Quad CPU Q9400 4x2.66GHz
8 GB RAM
120 GB SSD

I already tried another version of the image but had the exact same problem. I also tried running with docker-compose

Thanks for your help :slight_smile: