Gitlab-ce docker on apple m1 stuck on Recipe: gitlab::database_migrations

I try to use gitlab-ce docker on my apple M1.
But its stuck when system run at Recipe: gitlab::database_migrations line

This is my Compose file

version: “3.4”
services:
gitlab:
image: ‘gitlab/gitlab-ce’
restart: always
hostname: ‘gitlab.local’
container_name: gitlab-ce
platform: linux/amd64
links:
- postgresql:postgresql
environment:
GITLAB_OMNIBUS_CONFIG: |
postgresql[‘enable’] = true
gitlab_rails[‘db_username’] = “gitlab”
gitlab_rails[‘db_password’] = “gitlab”
gitlab_rails[‘db_host’] = “postgresql”
gitlab_rails[‘db_port’] = “5432”
gitlab_rails[‘db_database’] = “gitlabhq_production”
gitlab_rails[‘db_adapter’] = ‘postgresql’
gitlab_rails[‘db_encoding’] = ‘utf8’
external_url ‘http://gitlab.local:7778
gitlab_rails[‘gitlab_shell_ssh_port’] = 7722
ports:
- “7778:7778”
- “443:443”
- “7722:22”
volumes:
- gitlab-config:/etc/gitlab:rw
- gitlab-logs:/var/log/gitlab:rw
- gitlab-data:/var/opt/gitlab:rw
postgresql:
restart: always
image: postgres:12-alpine
container_name: gitlab-postgres
platform: linux/amd64
environment:
- POSTGRES_USER=gitlab
- POSTGRES_PASSWORD=gitlab
- POSTGRES_DB=gitlabhq_production
- TZ=Asia/Bangkok
- PGDATA=/data
volumes:
- gitlab-db-data:/data:rw
ports:
- “5432:5432”
volumes:
gitlab-db-data:
gitlab-config:
gitlab-logs:
gitlab-data:

Any Help ?

I have the same problem on my MacBook Air M1, both with the gitlab/gitlab-ce:latest and the gitlab/gitlab-ee:latest docker images.
The postgresql log file states:

2021-02-25_08:58:17.85439 LOG: starting PostgreSQL 12.5 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
2021-02-25_08:58:17.85983 LOG: listening on Unix socket “/var/opt/gitlab/postgresql/.s.PGSQL.5432”
2021-02-25_08:58:17.92693 LOG: database system was shut down at 2021-02-25 08:58:10 GMT
2021-02-25_08:58:17.95611 LOG: database system is ready to accept connections
2021-02-25_08:58:24.59202 FATAL: role “gitlab” does not exist
2021-02-25_08:58:25.04845 FATAL: database “gitlabhq_production” does not exist
2021-02-25_08:58:25.44870 FATAL: database “gitlabhq_production” does not exist
2021-02-25_09:04:38.17761 WARNING: could not open statistics file “pg_stat_tmp/global.stat”: Operation not permitted

The gitaly log files show an error:
{“error”:“open /var/opt/gitlab/gitaly/gitaly.pid: no such file or directory”,“level”:“error”,“msg”:“find gitaly”,“time”:“2021-02-25T08:57:56.682Z”,“wrapper”:1324}
, but I don’t think this is related.

The terminal outputs:

Recipe: gitlab::database_migrations
web_1 | * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
web_1 | * bash[migrate gitlab-rails database] action run
web_1 | [execute] rake aborted!
web_1 | TypeError: wrong argument type false (expected Symbol)
web_1 | /opt/gitlab/embedded/service/gitlab-rails/app/models/user.rb:132:in <class:User>' web_1 | /opt/gitlab/embedded/service/gitlab-rails/app/models/user.rb:5:in <top (required)>’
web_1 | /opt/gitlab/embedded/service/gitlab-rails/config/initializers/devise_dynamic_password_length_validation.rb:19:in <top (required)>' web_1 | /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:7:in <top (required)>’
web_1 | /opt/gitlab/embedded/bin/bundle:23:in load' web_1 | /opt/gitlab/embedded/bin/bundle:23:in
web_1 | Tasks: TOP => gitlab:db:configure => environment
web_1 | (See full trace by running task with --trace)
web_1 |
web_1 | ================================================================================
web_1 | Error executing action run on resource ‘bash[migrate gitlab-rails database]’
web_1 | ================================================================================
web_1 |
web_1 | Mixlib::ShellOut::ShellCommandFailed
web_1 | ------------------------------------
web_1 | Expected process to exit with [0], but received ‘1’
web_1 | ---- Begin output of “bash” “/tmp/chef-script20210225-95-1rvuo47” ----
web_1 | STDOUT: rake aborted!
web_1 | TypeError: wrong argument type false (expected Symbol)
web_1 | /opt/gitlab/embedded/service/gitlab-rails/app/models/user.rb:132:in <class:User>' web_1 | /opt/gitlab/embedded/service/gitlab-rails/app/models/user.rb:5:in <top (required)>’
web_1 | /opt/gitlab/embedded/service/gitlab-rails/config/initializers/devise_dynamic_password_length_validation.rb:19:in <top (required)>' web_1 | /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:7:in <top (required)>’
web_1 | /opt/gitlab/embedded/bin/bundle:23:in load' web_1 | /opt/gitlab/embedded/bin/bundle:23:in
web_1 | Tasks: TOP => gitlab:db:configure => environment
web_1 | (See full trace by running task with --trace)
web_1 | STDERR:
web_1 | ---- End output of “bash” “/tmp/chef-script20210225-95-1rvuo47” ----
web_1 | Ran “bash” “/tmp/chef-script20210225-95-1rvuo47” returned 1

I use docker-compose, but I think this is the same problem.
My docker-compose.yml

web:
image: ‘gitlab/gitlab-ce:latest’
restart: always
hostname: ‘gitlab.example.com
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url ‘http://gitlab.example.com
postgresql[‘custom_pg_hba_entries’] = { APPLICATION: [{ type: ‘local’, database: ‘all’, user: ‘all’, method: ‘trust’ }] }
# Add any other gitlab.rb configuration here, each on its own line
ports:
- ‘801:80’
- ‘444:443’
- ‘22:22’
volumes:
- ‘$GITLAB_HOME/config:/etc/gitlab’
- ‘$GITLAB_HOME/logs:/var/log/gitlab’
- ‘$GITLAB_HOME/data:/var/opt/gitlab’

Also note that on the gitlab-ee image, postgresql log files shows:
2021-02-25_10:22:29.08725 LOG: starting PostgreSQL 12.5 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
2021-02-25_10:22:29.09312 LOG: listening on Unix socket “/var/opt/gitlab/postgresql/.s.PGSQL.5432”
2021-02-25_10:22:29.15865 LOG: database system was shut down at 2021-02-25 10:22:22 GMT
2021-02-25_10:22:29.18261 LOG: database system is ready to accept connections
2021-02-25_10:22:36.34853 FATAL: role “gitlab” does not exist
2021-02-25_10:22:36.80858 FATAL: database “gitlabhq_production” does not exist
2021-02-25_10:22:37.20715 FATAL: database “gitlabhq_production” does not exist
2021-02-25_10:24:52.91185 PANIC: stuck spinlock detected at LockBufHdr, bufmgr.c:4142
2021-02-25_10:24:52.91506 qemu: uncaught target signal 6 (Aborted) - core dumped
2021-02-25_10:24:52.91723 LOG: background writer process (PID 1581) was terminated by signal 6: Aborted
2021-02-25_10:24:52.92389 LOG: terminating any other active server processes
2021-02-25_10:24:52.92592 WARNING: terminating connection because of crash of another server process
2021-02-25_10:24:52.92798 DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.

I think problems on postgresql problems

Any solutions?

same problem , any help?