Comparing version 4.0.2 to 4.0.3
@@ -15,2 +15,3 @@ var EventEmitter = require('events').EventEmitter, | ||
util = require('./util'), | ||
withSession = require('./session'); | ||
extend = util.extend; | ||
@@ -291,21 +292,42 @@ | ||
if (callback === undefined) { | ||
return new self.modem.Promise(function(resolve, reject) { | ||
util.prepareBuildContext(file, (ctx) => { | ||
optsf.file = ctx; | ||
self.modem.dial(optsf, function(err, data) { | ||
if (err) { | ||
return reject(err); | ||
function dial(callback) { | ||
util.prepareBuildContext(file, (ctx) => { | ||
optsf.file = ctx; | ||
self.modem.dial(optsf, callback); | ||
}); | ||
} | ||
function dialWithSession(callback) { | ||
if (opts?.version === "2") { | ||
withSession(self, optsf.authconfig,(err, sessionId, done) => { | ||
if (err) { | ||
return callback(err); | ||
} | ||
optsf.options.session = sessionId; | ||
dial((err, data) => { | ||
callback(err, data); | ||
if (data) { | ||
data.on("end", done); | ||
} | ||
resolve(data); | ||
}); | ||
}); | ||
} else { | ||
dial(callback); | ||
} | ||
} | ||
if (callback === undefined) { | ||
return new self.modem.Promise(function (resolve, reject) { | ||
dialWithSession(function (err, data) { | ||
if (err) { | ||
return reject(err); | ||
} | ||
resolve(data); | ||
}); | ||
}); | ||
} else { | ||
util.prepareBuildContext(file, (ctx) => { | ||
optsf.file = ctx; | ||
self.modem.dial(optsf, function(err, data) { | ||
callback(err, data); | ||
}); | ||
}) | ||
dialWithSession(callback); | ||
} | ||
@@ -1471,2 +1493,23 @@ }; | ||
/** | ||
* PullAll is a wrapper around createImage, to pull all image tags of an image. | ||
* @param {String} repoTag Repository tag | ||
* @param {Object} opts Options (optional) | ||
* @param {Function} callback Callback | ||
* @param {Object} auth Authentication (optional) | ||
* @return {Object} Image | ||
*/ | ||
Docker.prototype.pullAll = function(repoTag, opts, callback, auth) { | ||
var args = util.processArgs(opts, callback); | ||
var imageSrc = util.parseRepositoryTag(repoTag); | ||
args.opts.fromImage = imageSrc.repository; | ||
var argsf = [args.opts, args.callback]; | ||
if (auth) { | ||
argsf = [auth, args.opts, args.callback]; | ||
} | ||
return this.createImage.apply(this, argsf); | ||
}; | ||
/** | ||
* Like run command from Docker's CLI | ||
@@ -1835,2 +1878,2 @@ * @param {String} image Image name to be used. | ||
module.exports = Docker; | ||
module.exports = Docker; |
@@ -28,3 +28,3 @@ var util = require('./util'); | ||
var optsf = { | ||
path: '/plugins/' + this.name, | ||
path: '/plugins/' + this.name + '/json', | ||
method: 'GET', | ||
@@ -303,2 +303,3 @@ abortSignal: args.opts.abortSignal, | ||
200: true, | ||
204: true, | ||
404: 'plugin not installed', | ||
@@ -305,0 +306,0 @@ 500: 'server error' |
{ | ||
"name": "dockerode", | ||
"description": "Docker Remote API module.", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"author": "Pedro Dias <petermdias@gmail.com>", | ||
@@ -19,4 +19,8 @@ "maintainers": [ | ||
"@balena/dockerignore": "^1.0.2", | ||
"docker-modem": "^5.0.3", | ||
"tar-fs": "~2.0.1" | ||
"@grpc/grpc-js": "^1.11.1", | ||
"@grpc/proto-loader": "^0.7.13", | ||
"docker-modem": "^5.0.5", | ||
"protobufjs": "^7.3.2", | ||
"tar-fs": "~2.0.1", | ||
"uuid": "^10.0.0" | ||
}, | ||
@@ -23,0 +27,0 @@ "devDependencies": { |
@@ -208,3 +208,3 @@ # dockerode | ||
There is also support for [HTTP connection hijacking](https://docs.docker.com/engine/api/v1.22/#32-hijacking), | ||
There is also support for [HTTP connection hijacking](https://docs.docker.com/engine/api/v1.45/#tag/Container/operation/ContainerAttach), | ||
which allows for cleaner interactions with commands that work with stdin and stdout separately. | ||
@@ -419,2 +419,3 @@ | ||
- docker.pull(repoTag, options, callback, auth) - Like Docker's CLI pull | ||
- docker.pullAll(repoTag, options, callback, auth) - Like Docker's CLI pull with "-a" | ||
- docker.run(image, cmd, stream, createOptions, startOptions) - Like Docker's CLI run | ||
@@ -421,0 +422,0 @@ |
Sorry, the diff of this file is not supported yet
153325
25
4418
530
7
+ Added@grpc/grpc-js@^1.11.1
+ Added@grpc/proto-loader@^0.7.13
+ Addedprotobufjs@^7.3.2
+ Addeduuid@^10.0.0
+ Added@grpc/grpc-js@1.12.5(transitive)
+ Added@grpc/proto-loader@0.7.13(transitive)
+ Added@js-sdsl/ordered-map@4.4.2(transitive)
+ Added@protobufjs/aspromise@1.1.2(transitive)
+ Added@protobufjs/base64@1.1.2(transitive)
+ Added@protobufjs/codegen@2.0.4(transitive)
+ Added@protobufjs/eventemitter@1.1.0(transitive)
+ Added@protobufjs/fetch@1.1.0(transitive)
+ Added@protobufjs/float@1.0.2(transitive)
+ Added@protobufjs/inquire@1.1.0(transitive)
+ Added@protobufjs/path@1.1.2(transitive)
+ Added@protobufjs/pool@1.1.0(transitive)
+ Added@protobufjs/utf8@1.1.0(transitive)
+ Added@types/node@22.12.0(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcliui@8.0.1(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedlodash.camelcase@4.3.0(transitive)
+ Addedlong@5.2.4(transitive)
+ Addedprotobufjs@7.4.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addeduuid@10.0.0(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@17.7.2(transitive)
+ Addedyargs-parser@21.1.1(transitive)
Updateddocker-modem@^5.0.5