dockergitlabubuntu-22.04

GitLab docker cannot fork "Resource temporarily unavailable"


I tried to run a gitlab-ce docker container on a ubuntu server version 22.04.

The log output of docker logs --follow gitlab results in

execute[/opt/gitlab/bin/gitlab-ctl start alertmanager] action run
    [execute] /opt/gitlab/bin/gitlab-ctl: fork: retry: Resource temporarily unavailable

even though I have enough memory available by monitoring with htop. Docker exited with an error code 137. My docker-compose.yml file looks like

version: "3.7"
    gitlab:
        image: gitlab/gitlab-ce:latest
        container_name: gitlab
        restart: "no"
        ports:
            - "8929:8929"
            - "2289:22"
        hostname: "gitlab.example.com"
        environment:
            GITLAB_OMNIBUS_CONFIG: |
                external_url "https://gitlab.example.com"
                nginx['listen_port'] = 8929
                nginx['listen_https'] = false
                gitlab_rails['gitlab_shell_ssh_port'] = 2289
        volumes:
            - ./volumes/gitlab/config:/etc/gitlab
            - ./volumes/gitlab/logs:/var/log/gitlab
            - ./volumes/gitlab/data:/var/opt/gitlab
        shm_size: "256m"

I am using docker version 20.10.16. Other images work fine with docker. The output of ulimit -a is

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 1029348
max locked memory       (kbytes, -l) 65536
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 62987
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Solution

  • I had the same problem with a vServer which looks pretty much like your machine.

    I guess that the problem is a limit on the processes that can run at the same time. Probably you are limited by 400 but you need more to run your compose network.

    cat /proc/user_beancounters | grep numproc
    

    The response is formatted like this: held, maxheld, barrier, limit

    If you run this command, you should be able to see that you are very close to exceeding the limit (if I'm right with my assumption).

    Checkout this link, they talk about Java, but the general problem is the same: https://debianforum.de/forum/viewtopic.php?t=180774