Runner not hesolving host

I’m having a problem when I put the jobs to run with the runner container in a CentOS 8 server.

This is what appears when I try to execute a job:

Error log

And this is the gitlab-ci.yml tha I’m using:

Gitlab-ci.yml

I’ve already added the server SSH key into the project, but the problem persists. Thanks in advance for anyone who take a time to help me :grinning:

Try

ping gitlabteste.cesed.local

from your CentOS 8. If it also does not recognize gitlabteste.cesed.local, then probably there is a problem with your DNS. If you cannot solve it, then you might be willing to use the IP address instead.

1 Like

hello alexk, thanks for your time for answering me.
So, I did it on the server and inside the runner container and the two managed to ping the domain that I used for gitlab

Can you make sure that your external_url is set to external_url gitlabteste.cesed.local and not external_url = gitlabteste.cesed.local ?

1 Like

As @alexk suggested, I think the problem is that your ruby:2.5 container running inside your CI job can’t resolve the .local domain. The container itself (not the CentOS box) is trying to look up the IP of your .local URL but can’t do so without a custom DNS setting.

Can you add the following at the top of your before_script?

default:
  image: ruby:2.5
  before_script:
    - ping gitlabteste.cesed.local

This should fail with:

ping: gitlabteste.cesed.local: Name or service not known

A workaround is be to add the IP address to the /etc/hosts file inside the container at the start of the before_script.

Example (assuming gitlabteste.cesed.local has IP 123.45.67.89)

default:
  image: ruby:2.5
  before_script:
    - echo "123.45.67.89 gitlabteste.cesed.local" >> /etc/hosts
    - ping gitlabteste.cesed.local
1 Like

Hi alhemicar,

I’ve did in both ways and none of them worked

Hi Greg,

So … I changed the gitlab-ci.yml file and added the two lines, just like you told me, but the problem still persists. See the file and some logs that appeared after I added the two lines you asked me for: gitlab-ci.yml and logs

Hi @SezinandoVieira,

IP addresses that begin with 192.x.x.x are private IP addresses.

For the domain resolution to work inside the ruby:2.5 container, the IP address for gitlabteste.cesed.local will need to be a Public IP address for it to successfully resolve.

1 Like

Understand. But the “problem” is that the DNS I use is private and it is pointing to a private IP. And my installation of Gitlab is local, which is for internal use by a development team of the company I work for.I don’t know if still, I would have to do what you told me to solve the problem, or if there is a work around for that or even a definitive resolution