Skip to content

Commit

Permalink
Merge pull request #758 from AndreasHeine/add(feat)--pullAll
Browse files Browse the repository at this point in the history
add: new method pullAll
  • Loading branch information
apocas authored Feb 16, 2024
2 parents 54b3fb4 + 2a652b0 commit 3dbed5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
21 changes: 21 additions & 0 deletions lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3dbed5b

Please sign in to comment.