apocas / dockerode

Docker + Node = Dockerode (Node.js module for Docker's Remote API)
Apache License 2.0
4.32k stars 460 forks source link

Seems to not work with io.js #143

Closed knownasilya closed 8 years ago

knownasilya commented 9 years ago

Cannot verify first certificate. Not sure what the issue is.

Error: Cannot connect to Docker with options { host: '127.0.0.1',
  port: 2376,
  ca: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0a 4d 49 49 43 31 6a 43 43 41 63 43 67 41 77 49 42 41 67 49 52 41 50 ... >,
  cert: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0a 4d 49 49 43 35 7a 43 43 41 64 47 67 41 77 49 42 41 67 49 51 61 59 ... >,
  key: <Buffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0a 4d 49 49 45 6f 77 49 42 41 41 4b 43 41 51 45 41 6e 65 ... > }
Actual Error: Error: unable to verify the first certificate
    at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:908:38)
    at emitNone (events.js:67:13)
    at TLSSocket.emit (events.js:163:7)
    at TLSSocket._finishInit (_tls_wrap.js:496:8)
    at /Users/iradchenko/sandbox/strider/node_modules/strider-docker-runner/lib/run.js:10:19
    at /Users/iradchenko/sandbox/strider/node_modules/strider-docker-runner/lib/init.js:17:9
    at /Users/iradchenko/sandbox/strider/node_modules/strider-docker-runner/node_modules/dockerode/lib/docker.js:201:5
    at Modem.buildPayload (/Users/iradchenko/sandbox/strider/node_modules/strider-docker-runner/node_modules/dockerode/node_modules/docker-modem/lib/modem.js:204:19)
    at ClientRequest.<anonymous> (/Users/iradchenko/sandbox/strider/node_modules/strider-docker-runner/node_modules/dockerode/node_modules/docker-modem/lib/modem.js:189:10)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:166:7)
    at TLSSocket.socketErrorListener (_http_client.js:256:9)
    at emitOne (events.js:77:13)
    at TLSSocket.emit (events.js:166:7)
    at TLSSocket.<anonymous> (_tls_wrap.js:921:16)
    at emitNone (events.js:67:13)
    at TLSSocket.emit (events.js:163:7)
    at TLSSocket._finishInit (_tls_wrap.js:496:8)
rmg commented 9 years ago

I've noticed this as well and spent an evening trying to reduce it to an iojs test case. At first I thought it was iojs failing to use the provided CA to validate the certificate, or with the CA being self-signed, but there are actually test cases for those in the iojs test suite.

It might be useful to track here for a workaround, but I'm pretty sure the "bug" is either in iojs verifying the certs or in boot2docker generating the certs - though I admit I haven't been able to find anything conclusive.

apocas commented 9 years ago

Either way there's not much we can do in dockerode to fix this :) PS: and it seems related with boot2docker use cases.

rmg commented 9 years ago

I haven't noticed this being a problem for me lately. I'm not sure which change resolved it, but the following has changed since my previous comment:

knownasilya commented 9 years ago

@rmg how do you do number 3? Any guides?

rmg commented 9 years ago

@knownasilya I found the guides on docs.docker.com made it seem more complicated than it really was..

Here's a quick little equivalence table that shows basic boot2docker commands and their equivalent using docker-machine (operating on a VM named boot2docker):

boot2docker docker-machine
boot2docker init docker-machine create -d virtualbox boot2docker
eval $(boot2docker shellinit) eval $(docker-machine env boot2docker)
boot2docker ip docker-machine ip boot2docker

The docs are here: http://docs.docker.com/machine/ I installed it the same way I installed docker, homebrew: brew install docker-machine

knownasilya commented 9 years ago

Big thanks @rmg.

rmg commented 9 years ago

@knownasilya did switching to docker-machine solve it for you? If so, do you want to close this issue?

knownasilya commented 9 years ago

@rmg I've yet to give it a try. I'll do that next week.

apocas commented 8 years ago

I will close this one, since nodejs and iojs are now merged and everything is working well on node v4.x.