GitLab Runner: Registering runner... failed

I’m running GitLab 11.5.0 on Ubuntu bionic 18.04.1 LTS and I’m now attempting to set up GitLab Runner but without success.

I’ve followed the instructions and installed the latest version:

https://docs.gitlab.com/runner/install/linux-repository.html

When I attempt to register a runner, the registration process fails after asking for “gitlab-ci tags”:

sudo gitlab-runner register
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://my.gitlab.domain
Please enter the gitlab-ci token for this runner:
<token here>
Please enter the gitlab-ci description for this runner:
Shell Runner 1
Please enter the gitlab-ci tags for this runner (comma separated):
<left blank>

ERROR: Registering runner... failed                 runner=27wu5r7- status=couldn't execute POST against http://my.gitlab.domain/api/v4/runners: Post http://my.gitlab.domain/api/v4/runners: dial tcp: lookup my.gitlab.domain on 127.0.0.53:53: server misbehaving
PANIC: Failed to register this runner. Perhaps you are having network problems

I can confirm that GitLab is fully functional at the http://my.gitlab.domain location (I’ve replaced the real domain with this) and works normally. I’ve also tried using PostMaster to POST to the URL specified in the ERROR message, passing in the runner registration token and this seems to also work fine.

Any pointers in the right direction would be appreciated. Thanks.

This seems like a bug with gitlab-runner and or self-hosted gitlab. Perhaps there are missing instructions on how to setup a gitlab instance that will work with self-hosted runner.

You can get it to work with gitlab.com and register your self-hosted runner no problem.

If you use a self-hosted gitlab instance, no matter what you try it is not possible to register a runner. Even if you try to register on the same node that gitlab-runner works for gitlab.com, it will not register with the self-hosted instance.

I can confirm having tested on several instances, fresh installations and various combinations and versions of gitlab-runner. For testing purposes no firewalls were running on these any machines.

This all points to incomplete configuration due to docs or underlying bug somewhere.

At the time of this writing:

gitlab-runner --version
Version:      11.8.0
Git revision: 4745a6f3
Git branch:   11-8-stable
GO version:   go1.8.7
Built:        2019-02-22T08:01:16+0000
OS/Arch:      linux/amd64

ERROR: Registering runner... failed                 runner=3K9F7yWu status=500 Internal Server Error
PANIC: Failed to register this runner. Perhaps you are having network problems

Do you get any additional info when running the register command in debug mode? This error seems to almost always stem from networking problems. I wasn’t able to replicate this on a fresh install of the latest version of GitLab and GitLab Runner.

I’m having the same error with status=500 Internal Server Error

the next lines showing in debug mode

FATAL: Could not handle configuration file locking builds =0 error =file “/etc/gitlab-runner/config.toml” is locked by another process file =/etc/gitlab-runner/config.toml pid =10903

I am also facing the problem, any resolution for this issue?

Had this issue: reinstalled self-hosted gitlab and problem magically disappeared…