Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dockerode

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dockerode - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

lib/plugin.js

0

lib/container.js

@@ -0,0 +0,0 @@ var extend = require('./util').extend,

var EventEmitter = require('events').EventEmitter,
Modem = require('docker-modem'),
tar = require('tar-fs'),
zlib = require('zlib'),
fs = require('fs'),
concat = require('concat-stream'),
path = require('path'),
Container = require('./container'),

@@ -8,2 +13,4 @@ Image = require('./image'),

Service = require('./service'),
Plugin = require('./plugin'),
Secret = require('./secret'),
Task = require('./task'),

@@ -169,2 +176,6 @@ Node = require('./node'),

Docker.prototype.buildImage = function(file, opts, callback) {
var pack = tar.pack();
var content;
var self = this;
if (!callback && typeof opts === 'function') {

@@ -175,31 +186,43 @@ callback = opts;

var self = this;
var optsf = {
path: '/build?',
method: 'POST',
file: file,
options: opts,
isStream: true,
statusCodes: {
200: true,
500: 'server error'
}
};
function build(file) {
var optsf = {
path: '/build?',
method: 'POST',
file: file,
options: opts,
isStream: true,
statusCodes: {
200: true,
500: 'server error'
}
};
if (opts) {
if (opts.registryconfig) {
optsf.registryconfig = optsf.options.registryconfig;
delete optsf.options.registryconfig;
if (opts) {
if (opts.registryconfig) {
optsf.registryconfig = optsf.options.registryconfig;
delete optsf.options.registryconfig;
}
//undocumented?
if (opts.authconfig) {
optsf.authconfig = optsf.options.authconfig;
delete optsf.options.authconfig;
}
}
//undocumented?
if (opts.authconfig) {
optsf.authconfig = optsf.options.authconfig;
delete optsf.options.authconfig;
}
self.modem.dial(optsf, function(err, data) {
callback(err, data);
});
}
this.modem.dial(optsf, function(err, data) {
callback(err, data);
});
if (file.context) {
file.src.forEach(function(filePath) {
content = fs.readFileSync(path.join(file.context, filePath));
pack.entry({ name: filePath }, content);
});
pack.finalize();
pack.pipe(zlib.createGzip()).pipe(concat(build));
} else {
build(file);
}
};

@@ -232,2 +255,10 @@

/**
* Fetches a Plugin by name
* @param {String} name Volume's name
*/
Docker.prototype.getPlugin = function(name, remote) {
return new Plugin(this.modem, name, remote);
};
/**
* Fetches a Service by id

@@ -265,2 +296,10 @@ * @param {String} id Services's id

/**
* Fetches a Secret by id
* @param {String} id network's id
*/
Docker.prototype.getSecret = function(id) {
return new Secret(this.modem, id);
};
/**
* Fetches an Exec instance by ID

@@ -385,4 +424,193 @@ * @param {String} id Exec instance's ID

/**
* Creates a new secret
* @param {Object} opts Create options
* @param {Function} callback Callback
*/
Docker.prototype.createSecret = function(opts, callback) {
var args = util.processArgs(opts, callback);
var self = this;
var optsf = {
path: '/secrets/create?',
method: 'POST',
options: args.opts,
statusCodes: {
200: true, // unofficial, but proxies may return it
201: true,
406: 'server error or node is not part of a swarm',
409: 'name conflicts with an existing object',
500: 'server error'
}
};
this.modem.dial(optsf, function(err, data) {
if (err) return args.callback(err, data);
args.callback(err, self.getSecret(data.ID));
});
};
/**
* Lists secrets
* @param {Function} callback Callback
*/
Docker.prototype.listSecrets = function(opts, callback) {
var args = util.processArgs(opts, callback);
var optsf = {
path: '/secrets?',
method: 'GET',
options: args.opts,
statusCodes: {
200: true,
500: 'server error'
}
};
this.modem.dial(optsf, function(err, data) {
args.callback(err, data);
});
};
/**
* Creates a new plugin
* @param {Object} opts Create options
* @param {Function} callback Callback
*/
Docker.prototype.createPlugin = function(opts, callback) {
var args = util.processArgs(opts, callback);
var self = this;
var optsf = {
path: '/plugins/create?',
method: 'POST',
options: args.opts,
statusCodes: {
200: true, // unofficial, but proxies may return it
204: true,
500: 'server error'
}
};
this.modem.dial(optsf, function(err, data) {
if (err) return args.callback(err, data);
args.callback(err, self.getPlugin(args.name));
});
};
/**
* Lists plugins
* @param {Function} callback Callback
*/
Docker.prototype.listPlugins = function(opts, callback) {
var args = util.processArgs(opts, callback);
var optsf = {
path: '/plugins?',
method: 'GET',
options: args.opts,
statusCodes: {
200: true,
500: 'server error'
}
};
this.modem.dial(optsf, function(err, data) {
args.callback(err, data);
});
};
/**
* Prune images
* @param {Options} opts Options (optional)
* @param {Function} callback Callback
*/
Docker.prototype.pruneImages = function(opts, callback) {
var args = util.processArgs(opts, callback);
var optsf = {
path: '/images/prune?',
method: 'POST',
options: args.opts,
statusCodes: {
200: true,
500: 'server error'
}
};
this.modem.dial(optsf, function(err, data) {
args.callback(err, data);
});
};
/**
* Prune containers
* @param {Options} opts Options (optional)
* @param {Function} callback Callback
*/
Docker.prototype.pruneContainers = function(opts, callback) {
var args = util.processArgs(opts, callback);
var optsf = {
path: '/containers/prune?',
method: 'POST',
options: args.opts,
statusCodes: {
200: true,
500: 'server error'
}
};
this.modem.dial(optsf, function(err, data) {
args.callback(err, data);
});
};
/**
* Prune volumes
* @param {Options} opts Options (optional)
* @param {Function} callback Callback
*/
Docker.prototype.pruneVolumes = function(opts, callback) {
var args = util.processArgs(opts, callback);
var optsf = {
path: '/volumes/prune?',
method: 'POST',
options: args.opts,
statusCodes: {
200: true,
500: 'server error'
}
};
this.modem.dial(optsf, function(err, data) {
args.callback(err, data);
});
};
/**
* Prune networks
* @param {Options} opts Options (optional)
* @param {Function} callback Callback
*/
Docker.prototype.pruneNetworks = function(opts, callback) {
var args = util.processArgs(opts, callback);
var optsf = {
path: '/networks/prune?',
method: 'POST',
options: args.opts,
statusCodes: {
200: true,
500: 'server error'
}
};
this.modem.dial(optsf, function(err, data) {
args.callback(err, data);
});
};
/**
* Creates a new volume

@@ -852,2 +1080,13 @@ * @param {Object} opts Create options

Docker.Container = Container;
Docker.Image = Image;
Docker.Volume = Volume;
Docker.Network = Network;
Docker.Service = Service;
Docker.Plugin = Plugin;
Docker.Secret = Secret;
Docker.Task = Task;
Docker.Node = Node;
Docker.Exec = Exec;
module.exports = Docker;

@@ -0,0 +0,0 @@ var util = require('./util');

11

lib/image.js

@@ -87,9 +87,14 @@ var util = require('./util');

Image.prototype.push = function(opts, callback, auth) {
var args = util.processArgs(opts, callback);
var self = this;
var isStream = true;
if (args.opts.stream == false) {
isStream = false;
}
var optsf = {
path: '/images/' + this.name + '/push?',
method: 'POST',
options: opts,
authconfig: opts.authconfig || auth,
isStream: true,
options: args.opts,
authconfig: args.opts.authconfig || auth,
isStream: isStream,
statusCodes: {

@@ -96,0 +101,0 @@ 200: true,

@@ -0,0 +0,0 @@ var util = require('./util');

@@ -43,2 +43,31 @@ var util = require('./util');

/**
* Update a node.
*
* @param {object} options
* @param {function} callback
*/
Node.prototype.update = function(opts, callback) {
if (!callback && typeof opts === 'function') {
callback = opts;
}
var optsf = {
path: '/nodes/' + this.id + '/update?',
method: 'POST',
statusCodes: {
200: true,
404: 'no such node',
406: 'node is not part of a swarm',
500: 'server error'
},
options: opts
};
this.modem.dial(optsf, function(err, data) {
callback(err, data);
});
};
/**
* Remove a Node.

@@ -45,0 +74,0 @@ * Warning: This method is not documented in the API.

@@ -0,0 +0,0 @@ var util = require('./util');

@@ -0,0 +0,0 @@ var util = require('./util');

@@ -0,0 +0,0 @@ var util = require('./util');

{
"name": "dockerode",
"description": "Docker Remote API module.",
"version": "2.3.1",
"version": "2.3.2",
"author": "Pedro Dias <petermdias@gmail.com>",

@@ -18,3 +18,5 @@ "maintainers": [

"dependencies": {
"docker-modem": "0.3.x"
"concat-stream": "~1.5.1",
"docker-modem": "0.3.x",
"tar-fs": "~1.12.0"
},

@@ -21,0 +23,0 @@ "devDependencies": {

@@ -46,3 +46,4 @@ # dockerode

cert: fs.readFileSync('cert.pem'),
key: fs.readFileSync('key.pem')
key: fs.readFileSync('key.pem'),
version: 'v1.25' // required when Docker >= v1.13, https://docs.docker.com/engine/api/version-history/
});

@@ -105,2 +106,9 @@

});
docker.buildImage({
context: __dirname,
src: ['Dockerfile', 'file1', 'file2']
}, {t: imageName}, function (err, response) {
//...
});
```

@@ -107,0 +115,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc