AgustinCB / docker-api

Docker Remote API driver for node.js. It uses the same modem than dockerode, but the interface is promisified and with a fancier syntax.
GNU General Public License v3.0
303 stars 51 forks source link

How to filter events? #70

Open bendavis78 opened 3 years ago

bendavis78 commented 3 years ago

I'm trying to filter events by type=container, but this doesn't seem to work:

docker.events({
  since: ((new Date().getTime() / 1000)).toFixed(0),
  filter: {
    type: 'container'
  }
}).then(stream => {
  stream.on('data', data => {
    const event = JSON.parse(data.toString());
    logger.info(`DOCKER EVENT: Type=${event.Type} status=${event.status} from=${event.from}`);
  });
});

With the above code, I still get all event types.