docker / libcompose

*Unmaintained/Deprecated* An experimental go library providing Compose-like functionality
https://godoc.org/github.com/docker/libcompose
Apache License 2.0
586 stars 191 forks source link

Tie the docker events api into libcompose events #511

Open wagoodman opened 6 years ago

wagoodman commented 6 years ago

Currently the libcompose project object can notify when particular events occur via the AddListener function. This is great when you are trying to get events from libcompose actions, however, this doesn't appear to be tied into the docker events api (https://docs.docker.com/engine/api/v1.37/#operation/SystemEvents). This means that it is possible for a container to restart outside of libcompose's control (say with a typical docker restart ... cmd) and there would be no libcompose event.

Such cases where this matters would be when using the project.Log() method to follow logs in realtime, but then a container is restarted.... currently the existing reader is closed and a new one is not reopened once the container is restarted. This results in the Log() method silently loosing all future logs.

Though it is possible to get this functionality outside of libcompose by monitoring events from the docker events api and correlating container events with ids pulled from the libcompose... but this would not be ideal.