I followed the examples in the readme and did:
````
let Docker = require('dockerode');
let options = {
protocol:'http',
host: '127.0.0.1',
port: 2375
}
let docker = new Docker(options);
````
But it would still connect to the default unix socket. Finally I figured out that explicitly setting socketPath to null I could get it to respect the options. I.e. this works:
````
let Docker = require('dockerode');
let options = {
protocol:'http',
host: '127.0.0.1',
port: 2375,
socketPath: null
}
let docker = new Docker(options);
````
Using dockerode 3.0.2
The issue seems to be on line 72 in modem.js
var opts = Object.assign({}, defaultOpts(), options);
The defaultOpts contain a socketPath and it is not overridden by the options from dockerode and then takes precedence over the protocol, host and port
it is about docker-modem package. It always uses socketPath as default source.
Same here, in that case the dockerode documentation should be updated
It took me 3 hours to identify this problem, please, for the love of god, fix it please!
this problem take my 24 hours (totally). so please fix the readme.md or let me to fix that.
thank you dockerode
Just pushed a fix and added a test exactly for this scenario.
It's going to published in the next docker-modem version tomorrow.
Published in docker-modem v2.1.3
Most helpful comment
Just pushed a fix and added a test exactly for this scenario.
It's going to published in the next docker-modem version tomorrow.