Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ Amazing entities that [sponsor](https://github.com/sponsors/apocas) my open-sour

### Image

- image.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageInspect)
- image.inspect(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.48/#tag/Image/operation/ImageInspect)
- image.history() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageHistory)
- image.push(options, callback, auth) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImagePush)
- image.tag(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageTag)
Expand Down
5 changes: 4 additions & 1 deletion lib/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ Image.prototype[require('util').inspect.custom] = function() { return this; };

/**
* Inspect
* @param {Object} opts Inspect options, only 'manifests' (optional)
* @param {Function} callback Callback, if specified Docker will be queried.
* @return {Object} Name only if callback isn't specified.
*/
Image.prototype.inspect = function(callback) {
Image.prototype.inspect = function(opts, callback) {
var args = util.processArgs(opts, callback);
var self = this;

var opts = {
path: '/images/' + this.name + '/json',
method: 'GET',
options: args.opts,
statusCodes: {
200: true,
404: 'no such image',
Expand Down
2 changes: 1 addition & 1 deletion test/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ describe("#docker", function() {
});

stream.on("end", function () {
docker.getImage(randomId).inspect((err, image) => {
docker.getImage(randomId).inspect(undefined, (err, image) => {
expect(err).to.be.null;
expect(image).to.exist;
done();
Expand Down
14 changes: 13 additions & 1 deletion test/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ describe("#image", function() {
done();
}

image.inspect(handler);
image.inspect(undefined, handler);
});

it("should inspect an image with manifest", function (done) {
var image = docker.getImage(testImage);

function handler(err, data) {
expect(err).to.be.null;
expect(data).to.be.ok;
done();
}

image.inspect({manifest: 1}, handler);
});
});

Expand Down