Error when login to gitlab container registry in gitlab ci

I have the following gitlab ci job :

image: docker:stable

services:
  - docker:dind

stages:
  - debug

Debug registry login:
  stage: debug
  script:
    - docker login --username "$CI_REGISTRY_USER" --password "$CI_REGISTRY_PASSWORD" registry.exemple.com:port/

But the job fails with the following error :

Error response from daemon: 
Get https://registry.exemple.com:port/v2/: net/http: 
request canceled while waiting for connection 
(Client.Timeout exceeded while awaiting headers)

"$CI_REGISTRY_USER"and "$CI_REGISTRY_PASSWORD" are properly set, I tried to echo them and the right values are shown.

The container registry, the gitlab instance and the runners are all on the same ubuntu server.

If I try to login using the command in the job from my pc or via the serveur which run the job the connexion is successfull.

config of the runner :

[[runners]]
  name = "Smooth"
  url = "https://git.exemple.fr"
  token = "a5e28f2c95cf5ff887edb535f80e37"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "docker:stable"
    privileged = true
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]

1 answer

  • answered 2018-09-22 18:51 L. Faros

    Turns out deactivating cloudflare's dns for the git subdomain solved the issue. (The cloudflare dns are also off for the registry domain)