Runner registration failed in Centos 7

I’m working with Gitlab on a dcoker container, and I’m trying to register a runner for it, so I can run my jobs and pipelines without problems. But when I try to register the runner this error message shows up:

I have no clue what’s causing this issue. Thanks in advance to anyone who can help me with this !

Hi,

can you reach the GitLab API URL via curl http://... instead of running the CLI register command? If not, you can investigate further on the network reachability towards the GitLab server and with Docker.

How does your docker-compose.yml or Docker start command look like for running the container?

Cheers,
Michael

1 Like

Hi Michael, sorry for the delay to answer your questions.

So… My docker-compose.yml is like this:

stages:
  - web
  - dind
  - runner
  - register-runner
    web:
      stage: web
      image: 'gitlab/gitlab-ce:latest'
      restart: always
      hostname: 192.168.250.222
      environment:
        GITLAB_OMNIBUS_CONFIG: |
          external_url 'https://192.168.250.222'
  ports:
    - '80:80'
    - '443:443'
    - '22:22'
  volumes:
    - '$GITLAB_HOME/config:/etc/gitlab'
    - '$GITLAB_HOME/logs:/var/log/gitlab'
    - '$GITLAB_HOME/data:/var/opt/gitlab'
dind:
  stage: dind
  restart: always
  privileged: true
  volumes:
    - /var/lib/docker
  image: 'docker:17.09.0-ce-dind'
  command:
    - '--storage-driver=overlay2'
runner:
  stage: runner
  restart: always
  image: 'gitlab/gitlab-runner:alpine'
  volumes:
    - './gitlab/runner:/etc/gitlab-runner:Z'
  environment:
    - 'DOCKER_HOST=tcp://dind:2375'
register-runner:
  stage: register-runner
  restart: 'no'
  image: 'gitlab/gitlab-runner:alpine'
  volumes:
    - './gitlab/runner:/etc/gitlab-runner:Z'
  command:
    - register
    - '--non-interactive'
    - '--locked=false'
    - '--name=Docker Runner'
    - '--executor=docker'
    - '--docker-image=docker:17.09.0-ce-dind'
    - '--docker-volumes=/var/run/docker.sock:/var/run/docker.sock'
  environment:
    - 'CI_SERVER_URL=https://192.168.250.222/'
    - REGISTRATION_TOKEN=see_gitlab_admin_runner_setup

I’ve tried to initiate him trough a new portainer stack. The Gitlab container started fine, but the registration failed. I can’t reach the API URL because the server that I’m trying to make the runner work is just a thest server, and the DNS i’ts not properly configured. I reach the gitlab API through the server IP.
And the identation of the yml may seems wrong, but I’ve put in the right way. Regardless of anything, thank you very much for taking the time to try to help me. And again, sorry for the delay in responding to you

Hi,

no worries, I got too many things on my plate as well. I haven’t used 2 Docker containers for running GitLab and the runner yet, so I am guessing a bit.

During my search for docker-compose gitlab runner register I’ve found this issue with a suggestion to move the register portions into a script.

Also, it seems that your docker-compose configuration does not define a shared network between the two containers - which might be the overall culprit here.

You probably have found this gist which seems old and dated. Maybe start from scratch with the above linked example? :hammer:

Cheers,
Michael

Ok Michael. I’m going to give it a try, and as soon as I can, I’ll update de situation. Thanks a lot

Hi Michael, answering your question, yes I used the link gist you mentioned. I tried the alternative that you presented me and the stack went up, but the gitlab container is “unhealthy” and I can’t access it to be able to register the runner.

Here are some prints to show you how the situation is:

Please, if you need any more information about the problem, let me know that I’ll be happy to provide

Hi,

looks like the GitLab container does not boot correctly, or it runs into a timeout. Good entry point to research further. This might come from limited resources on the host, is that your desktop system where you run this, or how much hardware specs does the box have? And, a question of interest - is there a specific reason to not install the Omnibus packages and leave away Docker?

Cheers,
Michael

Hello,

So… I run the host on a virtual machine through XCP-ng Center. I’m going to attach some hardware informations about the virtual machine that I’m using to make the tests.

And about your last question, I’m not entirely sure what you are askin about, beacause my knowledge I’ts not that advanced. I search for the problem and try to solve with the stuff that I found on the internet. And about the Omnibus packages, I’ve just followed some steps to get the containers where they are, until I get stucked with this problem and this hole situation.

Hi,

I’m considering all options. If the problem is too time consuming and Docker won’t be able to run on your Xen VM, it may be a good idea to delete the images and start from scratch with installing the omnibus packages.

Or you’ll figure out from the container logs and health checks why the container cannot up cleanly. You could for example exec into the running container and check the running services. The logs should be mapped into the outside directories, the exact location is in the docker-compose config, - './gitlab-logs:/var/log/gitlab'.

Cheers,
Michael

Hi,

About this first option, my boss want’s me to install and provide de Gitlab to the Devs as a Docker container, so in that doesn’t consume too much hardware. I’ve tought to do in this way, but he didn’t accepted.

So, about the second option, I couldn’t find this path that you passed me to search. But I’ve could find these logs using the docker logs comand:

I don’t know if these logs helps in any way, but thanks once agin for take a time to help me out !

Hi,

the first log with Unicorn looks odd, since the new way of running the application stack is Puma as a webserver. The configuration snippet from https://gitlab.com/gitlab-org/gitlab/-/issues/23911#note_215199418 uses exactly that, try to remove the setting for unicorn from GITLAB_OMNIBUS_CONFIG and leave it to the default. Maybe that is the culprit here.

Cheers,
Michael

Hi Michael,

So I’ve tried to upload the new compose that you passed me. And I noticed some Errors and a Warnings, within the logs that appeared in the compose execution:

And the gitlab container started unhealthy once again. Do you think that if I can manage to configure a DNS server and use the URL, this error will stop top appear and finally work out ?

Cheers,
Sezinando