GitLab with Docker-compose on Mac OS fails to work

Hi!

I am trying 4th day in order to get GitLab working in the docker under Mac OS X Ventura.

Here is my docker-compose file:

version: '3.7'
services:
  db:
    image: 'postgres:latest'
    restart: always
    container_name: postgres
    environment:
      POSTGRES_USER: gitlab
      POSTGRES_PASSWORD: gitlab
      POSTGRES_DB: gitlabhq_production
    networks:
      - gitlab-net
    # ports:
    #   - '5432:5432'
    volumes:
      - '$GITLAB_HOME/db_data:/var/lib/postgresql/data'

  web:
    env_file:
    - .env
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    hostname: localhost
    container_name: gitlab
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        postgresql['enable'] = false;
        gitlab_rails['db_adapter'] = 'postgresql';
        gitlab_rails['db_encoding'] = 'utf8';
        gitlab_rails['db_username'] = 'gitlab';
        gitlab_rails['db_password'] = 'gitlab';
        gitlab_rails['db_host'] = 'db';
        gitlab_rails['db_port'] = '5432';
        gitlab_rails['db_database'] = 'gitlabhq_production';
        gitlab_rails['redis_host'] = 'redis';
        gitlab_rails['redis_port'] = 6379;
    ports:
      - '18080:80'
      - '18443:443'
      - '18022:22'
      - '18021:21'
    networks:
      - gitlab-net
    depends_on:
      - db
      - redis
    volumes:
      - '$GITLAB_HOME/config:/etc/gitlab'
      - '$GITLAB_HOME/logs:/var/log/gitlab'
      - '$GITLAB_HOME/data:/var/opt/gitlab'

  redis:
    image: redis:latest
    container_name: redis
    networks:
      - gitlab-net
    # ports:
    #   - '6379:6379'
networks:
  gitlab-net:
    driver: bridge

If I try without redis and postgres containers I cannot get it work at all. With this configuration I was able to make it work UNTIL I have turned off the containers for a night and re-started next day... Then.. 502 error chases me. I have errors dedicated to impossibility of listening of sockets for postgesql, redis, gitlab.

If I completely clean the binding folders in the host machine and try to reconfigure - everything will work until the next restart.

Very bad workaround 😄 :

I could make it work ONLY if EVERY TIME before start the container I remove all the dirs in the /data bound directory, excepting next:

/data/.ssh:/var/opt/gitlab/.ssh (to have ssh access for users) /data/git-data:/var/opt/gitlab/git-data (for repos) /data/gitlab-rails/uploads (for avatars and some other uploads)

Any help is highly appreciated!

Edited Sep 05, 2023 by Arsenii Gorkin
Assignee Loading
Time tracking Loading