0.9.8 • Published 10 years ago

docker.io v0.9.8

Weekly downloads
8
License
Apache 2
Repository
github
Last release
10 years ago

docker.io

Node.JS wrapper for low-level Docker.io HTTP interface

Usage

var docker = require('docker.js')({host:"http://localhost", port: "4243", version:'v1.1'});

// Note, the options for host, port and version are all optional. The values passed
// in this example are the defaults

We have implamented most of the container methods like:

  • list
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.list(options, handler);
// OR
docker.containers.list(handler);
  • create
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.create(options, handler);
// OR
docker.containers.create(handler);
  • inspect
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.inspect('263tbr762t37rtbd', options, handler);
// OR
docker.containers.inspect('263tbr762t37rtbd', handler);
  • inspectChanges
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.inspectChanges('263tbr762t37rtbd', options, handler);
// OR
docker.containers.inspectChanges('263tbr762t37rtbd', handler);
  • runExport
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.runExport('263tbr762t37rtbd', options, handler);
// OR
docker.containers.runExport('263tbr762t37rtbd', handler);
  • start
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.start('263tbr762t37rtbd', options, handler);
// OR
docker.containers.start('263tbr762t37rtbd', handler);
  • stop
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.stop('263tbr762t37rtbd', options, handler);
// OR
docker.containers.stop('263tbr762t37rtbd', handler);
  • restart
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.restart('263tbr762t37rtbd', options, handler);
// OR
docker.containers.restart('263tbr762t37rtbd', handler);
  • attach
// This gets fired on every line returned by the container for stderr, stdin, & stdout. It gets called once for logs
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.attach('263tbr762t37rtbd', options, handler);
// OR
docker.containers.attach('263tbr762t37rtbd', handler);
  • wait
// This fires once the container stops
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.wait('263tbr762t37rtbd', options, handler);
// OR
docker.containers.wait('263tbr762t37rtbd', handler);
  • runExport
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

var options = {}; // all options listed in the REST documentation for Docker are supported.

docker.containers.runExport('263tbr762t37rtbd', options, handler);
// OR
docker.containers.runExport('263tbr762t37rtbd', handler);
  • version
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

docker.version(handler);
  • info
function handler(err, res) {
    if (err) throw err;
    console.log("data returned from Docker as JS object: ", res);
}

docker.info(handler);

Other methods are implamented but a little buggy... PULL REQUESTS ARE WELCOME!

0.9.8

10 years ago

0.9.7

10 years ago

0.9.6

10 years ago

0.9.5

10 years ago

0.9.4

10 years ago

0.9.3

10 years ago

0.9.2

10 years ago

0.9.1

10 years ago

0.9.0

10 years ago

0.7.1

10 years ago

0.7.0

11 years ago

0.6.3

11 years ago

0.6.2

11 years ago

0.6.1

11 years ago

0.6.0

11 years ago

0.5.0

11 years ago

0.4.0

11 years ago

0.2.0

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago