Docker Swarm - alerts subscription

Hi,

I’ve got a Swarm manager and 3 workers.

I’d like to write a python script that subscribes to changes that are made with Swarm (for example, getting an alert once a container is being created and running, or getting an alert once a container is stopped).

Is it possible?

Thanks,
Efrat