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
Specs
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'
}
}
}
}
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.