GitLab GitLab

GitLab Community Edition

GitLab Community Edition docker image based on the Omnibus package

Visit the GitLab URL, and sign in with the username root and the password from the following command:
docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password

Register the runner (gitlab-runner service): https://docs.gitlab.com/runner/register/index.html#docker


Upgrade Path: GitLab requires stopping at intermediate versions (x.2, x.5, x.8, x.11) during upgrades. Background migrations must complete before proceeding to the next version. Example: 17.11 -> 18.2 -> 18.5 -> 18.8 (cannot skip intermediate stops)

PostgreSQL: GitLab 18+ requires PostgreSQL 16.5+. Version 14 is no longer supported. For single-node Linux package installs, run: sudo gitlab-ctl pg-upgrade -V 16 For HA/Geo/external DB setups, upgrade PostgreSQL manually before upgrading GitLab.

Check pending migrations before upgrading: docker exec -it gitlab gitlab-psql -c “SELECT job_class_name, table_name FROM batched_background_migrations WHERE status NOT IN(3, 6);”

Upgrade path calculator: https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/ Upgrade docs: https://docs.gitlab.com/update/versions/gitlab_18_changes/


Links:

name: gitlab
services:
  gitlab:
    image: gitlab/gitlab-ce:18.8.3-ce.0
    container_name: gitlab
    restart: unless-stopped
    # Do not use 'gitlab.${MYDOMAIN}', because the runner would use it and skip Traefik, resulting certificate error
    hostname: 'gitlab'
    environment:
      TZ: ${TIMEZONE}
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://gitlab.${MYDOMAIN}'
        # Add any other gitlab.rb configuration here, each on its own line
        gitlab_rails['gitlab_shell_ssh_port'] = 3022
        # HTTPS is handled by Traefik
        nginx['listen_https'] = false
        nginx['listen_port'] = 80
    ports:
      - '3022:22' # expose GitLab SSH on port 3022 on the host, as Traefik does not yet support TCP routing
    volumes:
      - '${DOCKER_VOLUMES}/gitlab/config:/etc/gitlab'
      - '${DOCKER_VOLUMES}/gitlab/logs:/var/log/gitlab'
      - '${DOCKER_VOLUMES}/gitlab/data:/var/opt/gitlab'
    shm_size: '256m'
    networks:
      - proxy

    labels:
      traefik.enable: true
      traefik.http.routers.gitlab.middlewares: localaccess@file
      traefik.http.services.gitlab.loadbalancer.server.port: 80

      homepage.group: Development
      homepage.name: GitLab
      homepage.icon: gitlab.png
      homepage.href: https://gitlab.${MYDOMAIN}/
      homepage.description: "GitLab Community Edition"

  gitlab-runner:
    image: gitlab/gitlab-runner:v18.8.0
    container_name: gitlab-runner
    restart: unless-stopped
    environment:
      TZ: ${TIMEZONE}
    volumes:
      - '${DOCKER_VOLUMES}/gitlab-runner/config:/etc/gitlab-runner'
      # kics-scan ignore-line
      - '/var/run/docker.sock:/var/run/docker.sock'
    networks:
      - proxy

networks:
  proxy:
    external: true