I have the following function:
run: function(opts) {
var self = this;
return self.createContainer(opts).catch(function(e) {
return self.pull(opts.Image).then(function(stream) {
return self.followProgress(stream);
}).then(function() {
return self.createContainer(opts);
});
}).then(function(o) {
Bluebird.promisify(o.start, {context: o})();
return o;
}).then(function(o) {;
var inspect = Bluebird.promisify(
o.inspect, {context: o}
);
return inspect();
});
},
which I call like this:
bitcoind: function(opts) {
return this.run({
name: 'bitcoind',
Image: 'seegno/bitcoind:latest',
Env: ['BITCOIN_DATA=/data'],
Binds: [process.cwd() + '/bitcoind:/data'],
HostConfig: {
PortBindings: {
'8332/tcp': [{ HostPort: '8332' }]
}
},
Cmd: [
'-server',
'-rpcuser=' + opts.user,
'-rpcpassword=' + opts.pass,
'-printtoconsole'
]
});
},
and everything works perfectly, almost. if I start my bitcoind server like this:
docker.bitcoind(config.bitcoind).then(function(info) {
var p = info.NetworkSettings.Ports;
console.log(p);
});
the console shows "null". the ports didn't get set. the command line shows me proper values. running
$ docker inspect bitcoind
I see:
"Ports": {
"18332/tcp": null,
"18333/tcp": null,
"18444/tcp": null,
"8332/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8332"
}
],
"8333/tcp": null
},
which is what I expected. so out of curiosity I then ran:
docker.inspect('693f32482b46').then(function(info) {
console.log(info);
});
and that contains the port information! so I'm puzzled as to why the inspection I ran at the end of the run() would return everything but the port mappings. had I failed to wait correctly for the process to start, inspection would have returned an empty value.
thoughts as to what might be going on here or what I should do differently?
I have the following function:
which I call like this:
and everything works perfectly, almost. if I start my bitcoind server like this:
the console shows "null". the ports didn't get set. the command line shows me proper values. running
I see:
which is what I expected. so out of curiosity I then ran:
and that contains the port information! so I'm puzzled as to why the inspection I ran at the end of the
run()would return everything but the port mappings. had I failed to wait correctly for the process to start, inspection would have returned an empty value.thoughts as to what might be going on here or what I should do differently?