Catch task start / stop events in docker swarm

Heyy there,

In one of my projects I need to catch certain events for example when a new task of a service in a docker swarm cluster is started, stopped etc. Unfortunately I have no clue if there is an option to do so.

I know that you can catch general container starts and stops but with that you can only catch these events on the local node, right?

Is there an option to catch task starts / stops and if not: Are there any workarounds?

Thanks in advance :slight_smile:

I would expect that Docker events are not available for Swarm, as Traefik reverse proxy is using polling when getting info from Swarm, whereas it uses events when only using local Docker.

Workaround options:

  1. Have an agent on every node listening to local events.
  2. Get each service status in interval from manager and manually calculate difference.