4

I have enabled the Continer Registry on Gitlab under the gitlab.yml file where I have set the registry_external_url to look like this http://registry.domain. I have configured my .gitlab-ci.yml to log in Docker this way: docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY an I have set the following docker image:

image: docker:18-git

  services:

    - docker:18-dind

But whenever I run the pipeline, I get the following error:

Error logging in to v2 endpoint, trying next endpoint: Get https://registry.domain/v2/: dial tcp: lookup registry.domain on IP adress : no such host"

I'm thinking it's because I'm using http instead of https but I'm not really sure about it.

Dawn tns
  • 143
  • 1
  • 7
  • Welcome on Stack Overflow. Can you view the registry in your browser by opening its URL? `no such host` tells that the hostname doesn't exist. – A.L Sep 13 '21 at 16:19
  • No I cannot that's the problem. I have set the url to be http://registry.mydomain but whenever I run the job I get an error stating that the connection to https://registry.mydomain:443 is refused – Dawn tns Sep 15 '21 at 14:01

1 Answers1

1

In your gitlab-runner running node's /etc/hosts file add (replace with your proper IP)

192.168.12.34 registry.domain

Then you may get insecure registry error

  1. /etc/docker/daemon.json (gitlab-runner running node's)
{
  "insecure-registries" : ["myregistrydomain.com:5000"]
}
  1. Restart docker in the node

Reference

Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94