How to use the dockerode/lib/container.prototype function in dockerode

To help you get started, we’ve selected a few dockerode examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ProboCI / probo / lib / _patchDockerodeInspect.js View on Github external
* an optional opts as the first argument to be able to get
 * container sizes (and use other future APIs)
 *
 * @module
 */

var Container = require('dockerode/lib/container');
var util = require('dockerode/lib/util');

/**
 * Inspect
 * @param {Options}   opts     Options (optional)
 * @param  {Function} callback Callback, if supplied will query Docker.
 * @return {Object}            ID only and only if callback isn't supplied.
 */
Container.prototype.inspect = function(opts, callback) {
  var args = util.processArgs(opts, callback);

  if (typeof args.callback === 'function') {
    var optsf = {
      path: '/containers/' + this.id + '/json?',
      method: 'GET',
      options: args.opts,
      statusCodes: {
        200: true,
        404: 'no such container',
        500: 'server error',
      },
    };

    this.modem.dial(optsf, function(err, data) {
      args.callback(err, data);