Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcollina/docker-allcontainers
Get notified when a new container is started or stopped
https://github.com/mcollina/docker-allcontainers
Last synced: about 2 months ago
JSON representation
Get notified when a new container is started or stopped
- Host: GitHub
- URL: https://github.com/mcollina/docker-allcontainers
- Owner: mcollina
- License: mit
- Created: 2015-02-04T14:00:24.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-11-13T17:11:23.000Z (about 7 years ago)
- Last Synced: 2024-10-19T09:09:38.419Z (2 months ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 19
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-allcontainers
Get notified when a new container is started or stopped
## Install
```bash
npm install docker-allcontainers --save
```## Usage
```js
var allContainer = require('docker-allcontainers')
var ee = allContainers({
preheat: true, // emit starts event for all already running containers
docker: null, // options to Dockerode
matchByName: /hello/, // optional
matchByImage: /matteocollina/, //optional
skipByName: /.*pasteur.*/, //optional
skipByImage: /.*dockerfile.*/ //optional
})
ee.on('start', function(meta, container) {
// container is a Dockerode Container
// see Dockerode API
console.log('started', meta)
})
ee.on('stop', function(meta, container) {
// container is a Dockerode Container
// see Dockerode API
console.log('stopped', meta)
})// stop after 5 secs
setTimeout(function() {
ee.destroy()
}, 5000)
```## License
MIT