Search code examples
dockerjenkinsdocker-registry

Jenkins pulling image from local registry: Client.Timeout exceeded while awaiting headers


I am running a docker registry locally on my machine, and I can pull my image from it successfully:

docker pull 192.168.174.205:5001/myimg:latest

I am also running a jenkins container on my machine, but Jenkins cannot pull any image from the local registry. I use a Blue Ocean container (on the same machine) to start a pipeline, and it outputs:

+ docker pull 192.168.174.205:5001/insureio:latest
Error response from daemon: Get https://192.168.174.205:5001/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
script returned exit code 1

TMI

Specs

  • Docker version 1.13.1, build 4ef4b30/1.13.1
  • Jenkins ver. 2.204.2
  • host CentOS Linux 7 (Core)

Reference

I have been working from the instructions on

Settings

My /etc/docker/daemon.json file reads {"insecure-registries" : ["192.168.174.205:5001"]}.

The local registry gives a 200 response:

curl http://192.168.174.205:5001/v2/_catalog
{"repositories":["mying"]}

My pipeline script is:

node {
  stage('Build') {
    docker.withRegistry('http://192.168.174.205:5001') {
      docker.image('insureio:latest').inside('') {
        sh 'make test'
      }
    }
  }
}

Solution

  • Since both Jenkins and your registry are containers, Jenkins is going to be looking at the 192.168.174.205 IP address at its own network space.

    If you're just trying things out, I would suggest doing a docker inspect <your registry container> | grep -i ipaddress to find its IP address (by default it should be in the region of 172.17.XXX.XXX) and configure your pipeline to use that address.