dkevents
Subscribe to a docker-engine event stream
Dependencies
- Docker Engine
- Node.js 6+
Install
$ npm install dkevents --save
Usage
const DockerEvents = // Create client (defaults to local Docker Engine socket)const client = // Add listener on eventclient // Handle errorsclient // Disconnect...// client.abort()
// DOCK=$(docker run ubuntu)// docker rm $DOCKevent: status: 'create' id: 'fbbab2881086b65b1e367ad8927c425590d2704ff56c575c215bc784cc783052' from: 'ubuntu' Type: 'container' Action: 'create' Actor: ID: 'fbbab2881086b65b1e367ad8927c425590d2704ff56c575c215bc784cc783052' Attributes: image: 'ubuntu' name: 'high_tesla' time: 1462152450 timeNano: '1462152450475828175' event: status: 'destroy' id: 'fbbab2881086b65b1e367ad8927c425590d2704ff56c575c215bc784cc783052' from: 'ubuntu' Type: 'container' Action: 'destroy' Actor: ID: 'fbbab2881086b65b1e367ad8927c425590d2704ff56c575c215bc784cc783052' Attributes: image: 'ubuntu' name: 'high_tesla' time: 1462152460 timeNano: '1462152460446697583'
Licence
MIT © Ben Evans