TritonDataCenter / node-docker-registry-client

node.js client for the docker registry
Mozilla Public License 2.0
64 stars 33 forks source link

`examples/v2/*.js ...` fail against an *http* registry #8

Closed trentm closed 8 years ago

trentm commented 8 years ago

If I'm testing against a local dev/test Docker registry over http (e.g. see http://trentm.com/2016/04/docker4mac-v2-registry.html), the example scripts fail:

$ node listTags.js http://docker.here/alpine
listTags: error: connect ECONNREFUSED

The issue is that in the ping and login calls made, the "http" is lost on the index URL and it fails while attempting to using https.

trentm commented 8 years ago

Fixed in commit 3580a81

trentm commented 8 years ago

@twhiteman Note: that http thing should finally be fixed now.

mingfang commented 8 years ago

I still can't use this against my private repository over http

node examples/v2/listTags.js http://tristar:5000/base -v -k
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"url":"http://tristar:5000","msg":"RegistryClientV2 url","time":"2016-05-20T02:32:03.431Z","v":0}
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"index":{"scheme":"http","name":"tristar:5000","official":false},"password":"(none)","scope":"repository:base:pull","msg":"login","time":"2016-05-20T02:32:03.433Z","v":0}
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"index":{"scheme":"http","name":"tristar:5000","official":false},"password":"(none)","scope":"repository:base:pull","msg":"ping","time":"2016-05-20T02:32:03.433Z","v":0}
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"client_req":{"method":"GET","url":"/v2/","address":"tristar","port":"5000","headers":{"accept":"application/json","user-agent":"node-docker-registry-client/3.1.6 (x64-linux; node/5.11.1)","date":"Fri, 20 May 2016 02:32:03 GMT"}},"msg":"request sent","time":"2016-05-20T02:32:03.440Z","v":0}
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"client_res":{"statusCode":200,"headers":{"content-length":"2","content-type":"application/json; charset=utf-8","docker-distribution-api-version":"registry/2.0","x-content-type-options":"nosniff","date":"Fri, 20 May 2016 02:31:49 GMT","connection":"close"}},"msg":"Response received","time":"2016-05-20T02:32:03.472Z","v":0}
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"body":"{}","len":2,"msg":"body received","time":"2016-05-20T02:32:03.473Z","v":0}
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"msg":"ending 1 sockets","time":"2016-05-20T02:32:03.474Z","v":0}
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"err":null,"success":true,"msg":"login: done","time":"2016-05-20T02:32:03.474Z","v":0}
{"name":"listTags","hostname":"minux","pid":22421,"level":10,"err":null,"loggedIn":true,"msg":"login: done","time":"2016-05-20T02:32:03.474Z","v":0}
_http_outgoing.js:344
    throw new Error('`value` required in setHeader("' + name + '", value).');
    ^

Error: `value` required in setHeader("authorization", value).
    at ClientRequest.OutgoingMessage.setHeader (_http_outgoing.js:344:11)
    at new ClientRequest (_http_client.js:85:14)
    at Object.exports.request (http.js:31:10)
    at rawRequest (/root/node-docker-registry-client/node_modules/restify/lib/clients/http_client.js:171:21)
    at FunctionCall.doCall_ (/root/node-docker-registry-client/node_modules/backoff/lib/function_call.js:156:20)
    at FunctionCall.start (/root/node-docker-registry-client/node_modules/backoff/lib/function_call.js:145:10)
    at DockerJsonClient.request (/root/node-docker-registry-client/node_modules/restify/lib/clients/http_client.js:597:10)
    at DockerJsonClient.read (/root/node-docker-registry-client/node_modules/restify/lib/clients/string_client.js:69:10)
    at DockerJsonClient.get (/root/node-docker-registry-client/node_modules/restify/lib/clients/http_client.js:508:18)
    at Object.call (/root/node-docker-registry-client/lib/registry-client-v2.js:1158:23)