From 461c4b768ce3660d2a505effa9f9755c924bb704 Mon Sep 17 00:00:00 2001 From: Andreas Heine Date: Fri, 9 Feb 2024 14:02:49 +0100 Subject: [PATCH 1/2] add: new method pullAll --- lib/docker.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/docker.js b/lib/docker.js index c37753a..022e28c 100644 --- a/lib/docker.js +++ b/lib/docker.js @@ -1465,6 +1465,27 @@ Docker.prototype.pull = function(repoTag, opts, callback, auth) { return this.createImage.apply(this, argsf); }; +/** + * 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 * @param {String} image Image name to be used. From 2a652b05bb6d7ca3cd9308db61e707939ed4c605 Mon Sep 17 00:00:00 2001 From: Andreas Heine Date: Fri, 9 Feb 2024 14:17:06 +0100 Subject: [PATCH 2/2] update: readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8ba70ed..4e6b54e 100644 --- a/README.md +++ b/README.md @@ -415,6 +415,7 @@ Amazing entities that [sponsor](https://github.com/sponsors/apocas) my open-sour - docker.swarmUpdate(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SwarmUpdate) - docker.swarmInspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SwarmInspect) - 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