Skip to content

FrozenRidge/dockhand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: This is rdd - readme driven development. Some of this is speculative :)

Dockhand

Node.JS interface to Docker.

docker.js provides a low level interface to Docker and this module extends that by providing nodelike constructs on top of that, so that you can transparently use docker instead of child_process, stream in and out of docker, manage containers, etc.

Dockhand

Dockhand is a function that takes a docker image address as an argument:

var dockhand = require('dockhand')('your/docker-image')

and provides a high level interface to the docker API. Dockhand simply wraps docker.js and if you need to access the basic api, you can 'drop down' to docker.js by doing:

var dockerjs = dockhand.api;

DockerProcess : Docker ChildProcess Shim

[Status: Vaporware]

If you want to transparently run a process in a docker container, instead of a child process, you can use the Dockhand ChildProcess shim:

var ChildProcess = require('dockhand')('your/docker-image').DockerProcess
  , ls = ChildProcess.spawn('ls', ['-lh', '/usr'])

ls.stdout.on('data', function(data) {
  console.log("stdout:", data) // Although ls is run within docker, this console is in the current context
})

Fork

[Status: Vaporware level red]

I don't even know what this will do

An example of why this is going to be cool:

Programatically running your unit tests in multiple OS's

var dockhand = require('dockhand')
  , environments = ["ubuntu:12.10", "ubuntu:11.10"]

environments.forEach(function(e){
  var env = dockhand(e);
  var proc = env.DockerProcess.spawn("git", ["clone", "github.com/my/repo"])
  proc.on('close', function(code){
    proc.exec("make", ["test"]);
  })
})

About

Node.JS interface to Docker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published