Problem to solve
I’ve recently upgraded my Proxmox server from 8.4 to 9, after which first everything looked good, but the Gitlab Docker container started to consume 100 % CPU in some puma process at some point. The used container image was somewhat old, don’t know the exact version any more, so I decided to just upgrade before further debugging. I switched to 18.2.1-ce.0 and am now running into a migration error, because Postgres is unable to start:
2025-08-10_14:49:28.62521 LOG: could not create Unix socket for address "/var/opt/gitlab/postgresql/.s.PGSQL.5432": Permission denied
2025-08-10_14:49:28.62522 WARNING: could not create Unix-domain socket in directory "/var/opt/gitlab/postgresql"
2025-08-10_14:49:28.62534 FATAL: could not create any Unix-domain sockets
2025-08-10_14:49:28.62780 LOG: database system is shut down
I’m somehwat sure that the problem is related to AppArmor, because whenever the container starts, I see the following logs in dmesg:
[164147.994516] audit: type=1400 audit(1754837366.474:1585466): apparmor="DENIED" operation="create" class="net" info="failed protocol match" error=-13 profile="docker-default" pid=534533 comm="gitaly" family="unix" sock_type="stream" protocol=0 requested="create" denied="create" addr=none
In theory I don’t care about AppArmor too much, but just want to get that problem fixed. So I though of making PostgreSQL simply NOT use sockets at all any more, but wasn’t able to do so. The following configs changes enable that Postgres uses TCP/IP, but it doesn’t disable using sockets. Might be that the additiuonal setting unix_socket_directories is not forarded as expected or …
1420 # postgresql['enable'] = true
1421 postgresql['listen_address'] = 'localhost'
1422 postgresql['unix_socket_directories'] = ''
1423 # postgresql['port'] = 5432
1 2025-08-10_14:49:28.62161 LOG: starting PostgreSQL 16.8 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, 64-bit
2 2025-08-10_14:49:28.62174 LOG: listening on IPv6 address "::1", port 5432
3 2025-08-10_14:49:28.62174 LOG: listening on IPv4 address "127.0.0.1", port 5432
4 2025-08-10_14:49:28.62521 LOG: could not create Unix socket for address "/var/opt/gitlab/postgresql/.s.PGSQL.5432": Permission denied
5 2025-08-10_14:49:28.62522 WARNING: could not create Unix-domain socket in directory "/var/opt/gitlab/postgresql"
6 2025-08-10_14:49:28.62534 FATAL: could not create any Unix-domain sockets
7 2025-08-10_14:49:28.62780 LOG: database system is shut down
What do I need to do to make Postgres within the Gitlab container not use Unix sockets at all?
I only found a workaround by disablinyg AppArmor entirely:
33 security_opt:
34 - 'apparmor:unconfined'
Steps to reproduce
I simply need to start the container and run into an endless loop of trying to upgrade and failing.
Versions
Please add an x whether options apply, and add the version information.
- Self-managed
-
GitLab.comSaaS - Dedicated
Versions
- GitLab 18.2.1-ce.0




