diff --git a/connector/docker.go b/connector/docker.go index 1b76424..f93e47f 100644 --- a/connector/docker.go +++ b/connector/docker.go @@ -78,18 +78,15 @@ func (cm *Docker) Wait() struct{} { return <-cm.closed } func (cm *Docker) watchEvents() { log.Info("docker event listener starting") events := make(chan *api.APIEvents) - cm.client.AddEventListener(events) + opts := api.EventsOptions{Filters: map[string][]string{ + "type": {"container"}, + "event": {"create", "start", "health_status", "pause", "unpause", "stop", "die", "destroy"}, + }, + } + cm.client.AddEventListenerWithOptions(opts, events) for e := range events { - if e.Type != "container" { - continue - } - actionName := e.Action - // fast skip all exec_* events: exec_create, exec_start, exec_die - if strings.HasPrefix(actionName, "exec_") { - continue - } // Action may have additional param i.e. "health_status: healthy" // We need to strip to have only action name sepIdx := strings.Index(actionName, ": ")