Create an event emitter from dockerode's events Stream
Docker exposes an event API, allowing one to monitor the happenings of a Docker host. dockerode allows for consumption of this API as node Stream @direktspeed/docker-events parsing the response stream and pushing things out of an EventEmitter.
accepts all dockerode options
var dockerEvents = new DockerEvents(options);
dockerEvents.start();
dockerEvents.stop();
dockerEvents.on("connect", function() {
console.log("connected to docker api");
});
dockerEvents.on("disconnect", function() {
console.log("disconnected to docker api; reconnecting");
});
dockerEvents.on("_message", function(message) {
console.log("got a message from docker: %j", message);
});
dockerEvents.on("create", function(message) {
console.log("container created: %j", message);
});
dockerEvents.on("start", function(message) {
console.log("container started: %j", message);
});
dockerEvents.on("stop", function(message) {
console.log("container stopped: %j", message);
});
dockerEvents.on("die", function(message) {
console.log("container died: %j", message);
});
dockerEvents.on("destroy", function(message) {
console.log("container destroyed: %j", message);
});