Jobs are unable to access my gitlab instance

Hello everybody,

I setup gitlab (with a registry and with runners) behind traefik all using a docker-compose file.
I started following the guide here Get started with GitLab CI/CD | GitLab but I am getting errors I guess at the repository cloning step.

I’m getting the following error:

fatal: unable to access 'https://mygitlab.com/myprojects/test-runner.git/': Failed to connect to mygitlab.com port 443 after 0 ms: Connection refused

I have the following config.toml for the runner:

[[runners]]
  name = "alpine-runner"
  url = "http://gitlab"
  token = "abcde0123456789"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "alpine:latest"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    extra_hosts = ["mygitlab.com:172.19.0.8"]
    shm_size = 0
    network_mode = "traefik"

Before I didn’t have the following keys: tls_verify, extra_hosts and network_mode. I tried to put them according to my setup, but I’m still getting that error. Before I tried with the network_mode, I was getting the same error with a timeout ~30 seconds, but with that I’m getting the same error with 0ms.

I should say that my gitlab (alongside the registry and the gitlab_runner) are all in the same docker-compose behind traefik. The connection between gitlab and the gitlab_registry is working fine (where I needed to set the certs and keys accordingly).

It seems this might be a problem of a host firewall (I’m using a VPS) but I’m not sure how to check this and how to solve this issue.

I found many posts in the net about people having the same problem but I didn’t find anything that I can apply in my case.

I’m sure it’s an easy to fix issue of you know what to configure properly but I’m lost.

Thank you very much.

I found for example the following post GitLab runner cannot connect to Gitlab (#27525) · Issues · GitLab.org / gitlab-runner · GitLab where the OP seems to have fixed the problem with some firewall rules but I’m not sure if I need to apply the same rules but also I’m not sure how to apply them…

Ok, I was able to solve the problem without touching anything…
I needed to use clone_url, this is my last config that is working:

[[runners]]
  name = "alpine-runner"
  url = "http://gitlab"                  # Relevant
  clone_url = "http://gitlab"            # Relevant
  token = "abcde0123456789"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "alpine:latest"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
    network_mode = "traefik"             # Relevant

gitlab is the name of my gitlab service in my docker-compose
traefik is the name of my network