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

i’m trying to reproduce the tuto from this link :

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
- docker:dind

- build


  - ping -c 4 || true
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN

  stage: build
    - 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
32795ea…3d99210 master -> origin/master
Checking out 3d992101 as master…
Skipping Git submodules setup
$ ping -c 4 || true
PING ( 56 data bytes
64 bytes from seq=0 ttl=64 time=0.112 ms
64 bytes from seq=1 ttl=64 time=0.075 ms
64 bytes from seq=2 ttl=64 time=0.073 ms
64 bytes from seq=3 ttl=64 time=0.057 ms

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

I am also having the same problem.

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


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