Skip to content

Commit

Permalink
optional options in run
Browse files Browse the repository at this point in the history
  • Loading branch information
apocas committed Apr 2, 2014
1 parent c2854c8 commit b5758de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions lib/docker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var Modem = require('docker-modem'),
Container = require('./container'),
Image = require('./image'),
util = require('./util');
util = require('./util'),
_ = require('underscore');

var Docker = function(opts) {
if (!(this instanceof Docker)) return new Docker(opts);
Expand Down Expand Up @@ -240,7 +241,11 @@ Docker.prototype.pull = function(repoTag, opts, callback) {
return this.createImage(pullOpts, callback);
};

Docker.prototype.run = function(image, cmd, streamo, callback) {
Docker.prototype.run = function(image, cmd, streamo, options, callback) {
if (!callback && typeof(options) === 'function') {
callback = options;
options = {};
}

function handler(err, container) {
if (err) return callback(err, container);
Expand Down Expand Up @@ -279,6 +284,8 @@ Docker.prototype.run = function(image, cmd, streamo, callback) {
'VolumesFrom': ''
};

_.extend(optsc, options);

this.createContainer(optsc, handler);
};

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"docker.io"
],
"dependencies": {
"docker-modem": "0.1.x"
"docker-modem": "0.1.x",
"underscore": "1.5.x"
},
"devDependencies": {
"chai": "~1.7.0",
Expand Down

0 comments on commit b5758de

Please sign in to comment.