Search code examples
dockerdocker-composegitlabgitlab-cigitlab-omnibus

Error when setting up GItlab Using Docker-Composer


I am following the tutorial here, and came up with the following configuration file for docker-compose:

web:
  image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.example.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.example.com'
      # Add any other gitlab.rb configuration here, each on its own line
  ports:
    - '3000:3000'
    - '3005:3005'
    - '3010:3010'
  volumes:
    - '/srv/gitlab/config:/etc/gitlab'
    - '/srv/gitlab/logs:/var/log/gitlab'
    - '/srv/gitlab/data:/var/opt/gitlab'

Then I run sudo docker-compose down; sudo docker-compose up -d and finally when I go to https://gitlab.example.com on Chrome I get the error DNS_PROBE_FINISHED_NXDOMAIN.

What am I doing wrong here? Am I supposed to do something else then just running the docker command above?

P.S: I noticed 2 weird problems:

  1. I cannot use export GITLAB_HOME=/srv/gitlab because if I replace '/srv/gitlab/config:/etc/gitlab' with $GITLAB_HOME/config:/etc/gitlab' it says that $GITLAB_HOME is empty;
  2. I cannot use port 22 as intended in the tutorial because it says it is not available or already in use.

I am running these configurations on Pop!_OS 20.04 LTS.


Solution

  • For anyone with the same problem:

    I changed my code to this:

    web:
      image: 'gitlab/gitlab-ce:latest'
      restart: always
      hostname: 'gitlab.local.com'
      environment:
        GITLAB_OMNIBUS_CONFIG: |
          external_url 'http://gitlab.local.com:8929'
          gitlab_rails['gitlab_shell_ssh_port'] = 2224
      ports:
        - '8929:8929'
        - '2224:22'
      volumes:
        - '/srv/gitlab/config:/etc/gitlab'
        - '/srv/gitlab/logs:/var/log/gitlab'
        - '/srv/gitlab/data:/var/opt/gitlab'
    

    Only for personal taste.

    Then I added the following line to the file located in /etc/hosts: 0.0.0.0 gitlab.local.com.