Skip to content
Bart edited this page Oct 16, 2014 · 1 revision

dockops build status

docker convenience functions on top of dockerode

Table of Contents generated with DocToc

var dockops = require('dockops')
var docker = dockops.createDocker({ dockerhost: dockerhost });

var images = new dockops.Images(docker);
dockops.logEvents(images, 'verbose');

var containers = new dockops.Containers(docker);
dockops.logEvents(containers, 'verbose');

build('test:uno', testUnoTar, function () {
  build('toast:uno', toastUnoTar, function () {

    containers.run(.. // run test:uno and toast:uno containers

    containers.listRunning(function (err, res) {
      inspect(res);
      containers.stopRemoveGroup('test', function (err, res) {
        containers.listRunning(function (err, res) {
          inspect(res);
          http.request({ port: 49222 }, function (res) {
            console.log('--------------------------')
            inspect({ status: res.statusCode, headers: res.headers })
            res.pipe(process.stdout)
          }).end()
        }) 
      })
    })
  })
})

full example

output

Installation

npm install dockops

API

dockops::Containers(docker) → {Object}

Creates a new containers instance that will use the given docker instance to communicate with docker.

Parameters:
Name Type Description
docker Object

dockerode instance to communicate with docker

Source:
Returns:

initialized containers

Type
Object

dockops::Containers::activePorts(cb)

Lists all running containers by the ports they expose.

Parameters:
Name Type Description
cb function

called back with list of containers hashed by their port number

Source:

dockops::Containers::clean(id, cb)

Stops and/or kills and then removes a container.

Heavy machinery clean operation. It was useful when running on arch with docker not always working as promised. This may not be needed anymore as docker got more stable.

Parameters:
Name Type Description
id string

container id

cb function

called back after container was cleaned or maximum attempts were exceeded

Source:

generated with docme

License

MIT

Clone this wiki locally