Gitlab CI and Docker Registry Client.Timeout exceeded while awaiting headers

Hello,
i’m trying to reproduce the tuto from this link : https://about.gitlab.com/2016/05/23/gitlab-container-registry/

But when Gitlab is running the CI, i’m getting an error :

As you can see, the Ping and WGet is working but not the Docker Login

The Gitlab CI yml:
image: docker:git
services:
- docker:dind

stages:
- build

variables:
  CONTAINER_TEST_IMAGE: gitlab-registry.mydomain.com:4567/root/mydomain-docker:$CI_BUILD_REF_NAME
  CONTAINER_RELEASE_IMAGE: gitlab-registry.mydomain.com:4567/root/mydomain-docker:latest
  GIT_SSL_NO_VERIFY: "true"

before_script:
  - ping -c 4 gitlab-registry.mydomain.com || true
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.mydomain.com:4567

build:
  stage: build
  script:
    - docker build -t $CONTAINER_TEST_IMAGE .
    - docker push $CONTAINER_TEST_IMAGE

The Gitlab CI log:
Running with gitlab-runner 10.3.0 (5cf5e19a)
on pbrlamp1101 (261fbc8b)
Using Docker executor with image docker:git …
Starting service docker:dind …
Pulling docker image docker:dind …
Using docker image docker:dind ID=sha256:72904c4aeb8eb51b36ccba92c543e01ee4bb9459f95270e1fc4a4609f7e0e52a for docker service…
Waiting for services to be up and running…
Using docker image sha256:b143977a3dc73d8f02d0b7f5c36918fadc09c486728fc0697a6f764a6dbe765c for predefined container…
Pulling docker image docker:git …
Using docker image docker:git ID=sha256:c5880fcba2c80931d5ca74e10e8a5f1d91f49e5558a3f3ed66af39d9c5f639ff for build container…
Running on runner-261fbc8b-project-71-concurrent-0 via pbrlamp1101…
Fetching changes…
HEAD is now at 32795ea Update .gitlab-ci.yml
From https://gitlab.mydomain.com/root/mydomain-docker
32795ea…3d99210 master -> origin/master
Checking out 3d992101 as master…
Skipping Git submodules setup
$ ping -c 4 gitlab-registry.mydomain.com || true
PING gitlab-registry.mydomain.com (172.17.0.1): 56 data bytes
64 bytes from 172.17.0.1: seq=0 ttl=64 time=0.112 ms
64 bytes from 172.17.0.1: seq=1 ttl=64 time=0.075 ms
64 bytes from 172.17.0.1: seq=2 ttl=64 time=0.073 ms
64 bytes from 172.17.0.1: seq=3 ttl=64 time=0.057 ms

--- gitlab-registry.mydomain.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.057/0.079/0.112 ms
$ wget https://gitlab-registry.mydomain.com:4567/v2/ || true
Connecting to gitlab-registry.mydomain.com:4567 (172.17.0.1:4567)
wget: server returned error: HTTP/1.1 401 Unauthorized
$ docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN https://gitlab-registry.mydomain.com:4567
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://gitlab-registry.mydomain.com:4567/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
ERROR: Job failed: exit code 1

+1,
I am also having the same problem.

Hello,
i fixed the problem by setting:

  • Settings / Account and Limit settings / Session duration : 10000
  • Settings / Container Registry / Authorization token duration : 8000
  • Project settings / CI/CD / General Pipelines settings / Timeout : 800
  • And as i run gitlab behind a reverse proxy, set the “ProxyTimeout 18000” in virtual host setting

Hope it solves your problem too

Nicolas

Thank you for your sharing, but it seems not work in my case …