UNPKG

docker.io

Version:

wrapper for the docker.io REST interface

35 lines (34 loc) 6.03 kB
{ "name": "docker.io", "version": "0.9.8", "description": "wrapper for the docker.io REST interface", "main": "./lib", "scripts": { "test": "./node_modules/mocha/bin/mocha -u tdd -R spec --check-leaks --slow 15 tests.js" }, "repository": { "type": "git", "url": "git://github.com/appersonlabs/docker.io.git" }, "keywords": [ "docker", "docker.io" ], "author": { "name": "Matt Apperson" }, "license": "Apache 2", "readmeFilename": "README.md", "dependencies": { "docker-modem": "*", "flat-validator": "git://github.com/appersonlabs/flat-validator.git", "node-v8-clone": "~0.4.5" }, "devDependencies": { "chai": "~1.8.0", "mocha": "~1.14.0" }, "readme": "docker.io\n=========\n\nNode.JS wrapper for low-level Docker.io HTTP interface\n\n## Usage\n\n```javascript\n\nvar docker = require('docker.js')({host:\"http://localhost\", port: \"4243\", version:'v1.1'});\n\n// Note, the options for host, port and version are all optional. The values passed\n// in this example are the defaults\n\n```\n\nWe have implamented most of the container methods like:\n\n- list\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.list(options, handler);\n// OR\ndocker.containers.list(handler);\n\n```\n\n- create\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.create(options, handler);\n// OR\ndocker.containers.create(handler);\n\n```\n\n- inspect\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.inspect('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.inspect('263tbr762t37rtbd', handler);\n\n\n```\n\n- inspectChanges\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.inspectChanges('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.inspectChanges('263tbr762t37rtbd', handler);\n\n```\n\n- runExport\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.runExport('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.runExport('263tbr762t37rtbd', handler);\n```\n\n- start\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.start('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.start('263tbr762t37rtbd', handler);\n```\n\n- stop\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.stop('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.stop('263tbr762t37rtbd', handler);\n```\n\n- restart\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.restart('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.restart('263tbr762t37rtbd', handler);\n```\n\n- attach\n\n```javascript\n\n// This gets fired on every line returned by the container for stderr, stdin, & stdout. It gets called once for logs\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.attach('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.attach('263tbr762t37rtbd', handler);\n```\n\n- wait\n\n```javascript\n\n// This fires once the container stops\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.wait('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.wait('263tbr762t37rtbd', handler);\n```\n\n- runExport\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\nvar options = {}; // all options listed in the REST documentation for Docker are supported.\n\ndocker.containers.runExport('263tbr762t37rtbd', options, handler);\n// OR\ndocker.containers.runExport('263tbr762t37rtbd', handler);\n```\n\n- version\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\ndocker.version(handler);\n```\n\n- info\n\n```javascript\n\nfunction handler(err, res) {\n if (err) throw err;\n console.log(\"data returned from Docker as JS object: \", res);\n}\n\ndocker.info(handler);\n```\n\nOther methods are implamented but a little buggy... PULL REQUESTS ARE WELCOME!", "_id": "docker.io@0.2.0", "_from": "docker.io@*" }