Skip to content

Commit b15fc4b

Browse files
authored
Merge pull request #800 from jpinz/inspect-manifest-param
Update image.inspect method to accept options
2 parents 0f2ce8b + 23a36b0 commit b15fc4b

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ Amazing entities that [sponsor](https://github.com/sponsors/apocas) my open-sour
453453

454454
### Image
455455

456-
- image.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageInspect)
456+
- image.inspect(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.48/#tag/Image/operation/ImageInspect)
457457
- image.history() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageHistory)
458458
- image.push(options, callback, auth) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImagePush)
459459
- image.tag(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageTag)

lib/image.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ Image.prototype[require('util').inspect.custom] = function() { return this; };
1414

1515
/**
1616
* Inspect
17+
* @param {Object} opts Inspect options, only 'manifests' (optional)
1718
* @param {Function} callback Callback, if specified Docker will be queried.
1819
* @return {Object} Name only if callback isn't specified.
1920
*/
20-
Image.prototype.inspect = function(callback) {
21+
Image.prototype.inspect = function(opts, callback) {
22+
var args = util.processArgs(opts, callback);
2123
var self = this;
2224

2325
var opts = {
2426
path: '/images/' + this.name + '/json',
2527
method: 'GET',
28+
options: args.opts,
2629
statusCodes: {
2730
200: true,
2831
404: 'no such image',

test/docker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ describe("#docker", function() {
273273
});
274274

275275
stream.on("end", function () {
276-
docker.getImage(randomId).inspect((err, image) => {
276+
docker.getImage(randomId).inspect(undefined, (err, image) => {
277277
expect(err).to.be.null;
278278
expect(image).to.exist;
279279
done();

test/image.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ describe("#image", function() {
1717
done();
1818
}
1919

20-
image.inspect(handler);
20+
image.inspect(undefined, handler);
21+
});
22+
23+
it("should inspect an image with manifest", function (done) {
24+
var image = docker.getImage(testImage);
25+
26+
function handler(err, data) {
27+
expect(err).to.be.null;
28+
expect(data).to.be.ok;
29+
done();
30+
}
31+
32+
image.inspect({manifest: 1}, handler);
2133
});
2234
});
2335

0 commit comments

Comments
 (0)