code: function processDockerEvent(event, stop) {
      if (trackedEvents.indexOf(event.status) !== -1) {
        var container = containerById.get(event.id);
        if (container) {
          if (positiveEvents.indexOf(event.status) !== -1) {
            updateContainer(container);
          } else {
            removeContainer(container);
          }
        } else {
          // new container
          if (!stop && positiveEvents.indexOf(event.status) !== -1) {
            updateContainers(function(err) {
              if (!err) {
                processDockerEvent(event, true);
              }
            });
          }
        }
      }
    }
docs: start monitoring docker events