Dockership
Scriptable docker management tool build upon Docker remote API.
Usage
1. Get Start
var Dockership = ; var dockerConfig = ca: 'path/to/ca' // Can also be a Buffer of ca.pem cert: 'path/to/cert' key: 'path/to/key' host: '0.0.0.0' port: 2376; var ship = docker: dockerConfig // Config obj used to construct docker remote client buildContext: 'path/to/dockerfile/parent/dir' // Absolute, or relative to cwd meta: metaConfig // Information describing docker images and how to run containers;
2. API
Dockership use dockerode and bluebird internally. All API calls will return a bluebird promise.
images
method
Resolve with remote images specified by metaConfig
.
shipimages;
containers
method
ship;
build
method
ship;
ship
instance is an EventEmitter instance. You can listen to events emitted during build process.
ship;
Dockership comes with logger helper to help log buildMessage
to console.
var logger = Dockership;ship;
logger
can be customized by passing a modifier function:
var logger = Dockership; ship; // Prepend "Prefix " to every line of message
start
method
shipstart;
By default, start
will start stopped container or create container from image specified in metaConfig
. If such container or image cannot be found, start
will reject.
stop
method
Stop will stop all containers match the description in metaConfig
.
ship;
exec
method
Execute command inside container. Reject if running container cannot be found.
ship;
this
context
All promise callback have this
refer to current ship
instance.
ship ;
TODO
- Improve event emitting, especially error emitting.