Search code examples
dockergitlabgitlab-cigitlab-ci-runner

How to configure gitlab-ce domain url on docker


I need some help to configure correctly my gitlab docker container from gitlab/gitlab-ce:latest.

I have a domain nas.toto.eu and i have deploy gitlab on this domain with 8484 port

version: "3.7"
services:
  gitlab:
    image: 'gitlab/gitlab-ce:latest'
    container_name: gitlab
    restart: unless-stopped
    hostname: 'nas.toto.eu'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://nas.toto.eu'
        gitlab_rails['gitlab_shell_ssh_port'] = 2323
    ports:
      - '8484:80'
      - '8585:443'
      - '2323:22'
    volumes:
      - '/volume1/scripts/docker/gitlab/config:/etc/gitlab'
      - '/volume1/scripts/docker/gitlab/logs:/var/log/gitlab'
      - '/volume1/scripts/docker/gitlab/data:/var/opt/gitlab'
    networks:
      - gitlab

  gitlab-runner:
    image: gitlab/gitlab-runner:alpine
    container_name: gitlab-runner
    restart: unless-stopped
    depends_on:
      - gitlab
    volumes:
      - '/volume1/scripts/docker/gitlab/gitlab-runner:/etc/gitlab-runner'
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - gitlab

networks:
  gitlab:

It work fine and i can clone my project perflectly with my domain http://nas.toto.eu:8484. =D

When i try to use gitlab-ci, gitlab use a bad url (no port on this url :/ ) :

fatal: unable to access 'http://nas.toto.eu/extranet/frontend.git/': Empty reply from server

This project exist on http://nas.toto.eu:8484 and not on http://nas.toto.eu. In addition, when i edit .gitlab-ci.yml file with webIDE, link to back to project have wrong url too.

I have find clone_url option on my runner to correct url but the connection timeout.

[[runners]]
  name = "first runner"
  url = "http://172.24.0.2"
  clone_url = "http://172.24.0.2:8484"

But i have the same error :

fatal: unable to access 'http://172.24.0.2:8484/extranet/backend.git/': Failed to connect to 172.24.0.2 port 8484: Operation timed out

How can correct that ? Is there a special network configuration ?

Thanks for your response !


Solution

  • After a very very long time, i found the good configuration. The problem is in my gitlab-runner. In fact, if gitlab is accessible from outside and if i configure my runner with the url nas.toto.eu:8484, it work :

    [[runners]]
      name = "first runner"
      url = "http://nas.toto.eu:8484"
      clone_url = "http://nas.toto.eu:8484"
    

    I don't understand why it's work like this. :(