Jerome
Jerome

Reputation: 1192

Start a docker machine using JavaScript

I'm actually facing a problem to start my machine by my JavaScript. I can stop the running machines without any problems but I can't start.

The error is the next one :

/Users/swisscom_NG/Desktop/mgmt-docker-gui/node_modules/docker-machine/index.js:79
W20170106-13:19:51.164(1)? (STDERR)         done()
W20170106-13:19:51.164(1)? (STDERR)         ^
W20170106-13:19:51.165(1)? (STDERR)
W20170106-13:19:51.165(1)? (STDERR) TypeError: done is not a function

The code executed is :

'machine.start': function(name){
  Machine.start(name);
}

And Machine is defined like this:

import Machine from 'docker-machine';

The error is because it thinks that the machine is running but if I look into Docker I can see : enter image description here

I'm using node-docker-machine

Thank you for your help.

Upvotes: 0

Views: 77

Answers (1)

damianfabian
damianfabian

Reputation: 1681

If you check the documentation of docker-machine you need to pass a done function to get the callback when docker-machine finish the start event. so just change your code as this:

Machine.start(name, function(){ console.log('Docker Started') });

Upvotes: 2

Related Questions