Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

azuki-trusty / azk   deb

Repository URL to install this package:

Version: 0.5.1 

/ usr / lib / azk / node_modules / dockerode / examples / timeout.js

var Docker = require('../lib/docker');
var fs     = require('fs');

var socket = process.env.DOCKER_SOCKET || '/var/run/docker.sock';
var stats  = fs.statSync(socket);

if (!stats.isSocket()) {
  throw new Error("Are you sure the docker is running?");
}

//you may specify a timeout for all operations, allowing to make sure you don't fall into limbo if something happens in docker
var docker = new Docker({host: 'http://127.0.0.1', port: 2375, timeout: 1});

docker.createContainer({Image: 'ubuntu', Cmd: ['/bin/bash']}, function (err, container) {
  container.start(function (err, data) {
    container.top({ps_args: 'aux'}, function(err, data) {
      console.log(data);
    });
  });
});