mcollina / docker-allcontainers

Get notified when a new container is started or stopped
MIT License
19 stars 9 forks source link

Make sure all "stop" events are handled correctly #11

Closed megastef closed 8 years ago

megastef commented 8 years ago

We've got this issue https://github.com/sematext/sematext-agent-docker/issues/15 and my current working theory is that docker-allcontainers does not catch all events, terminating containers.

See: https://github.com/mcollina/docker-allcontainers/blob/master/allcontainers.js#L87

And a chart with docker events shows at least "kill" (and I think "destroy") is not listed in code above. bildschirmfoto 2016-08-23 um 18 06 50

I will check and provide eventually a PR. I would appreciade if anybody has some other ideas around this issue (query for Docker stats for non existing containers).

megastef commented 8 years ago

Example of events fired when container gets removed (docker rm -f), we see first kill, die then destroy.

docker rm -f r1
2016-08-24T15:59:26.777288055-04:00 container kill 4c7fba6e02cde90de1f7f1365134cc0a8ff98da889a0c8164f7f24e921b96f57 (image=redis, name=r1, signal=9)
2016-08-24T15:59:26.802158714-04:00 container die 4c7fba6e02cde90de1f7f1365134cc0a8ff98da889a0c8164f7f24e921b96f57 (exitCode=137, image=redis, name=r1)
2016-08-24T15:59:26.858281973-04:00 network disconnect 4e012eb5128627ada20aa8dfa031421adcf9bc1ed785de77fb2bfe9af53f1780 (container=4c7fba6e02cde90de1f7f1365134cc0a8ff98da889a0c8164f7f24e921b96f57, name=bridge, type=bridge)
2016-08-24T15:59:26.892308397-04:00 volume unmount 81ba4ac63895bf78205819408ff8143e7971f2e4c3fbf013fb8307a409a49804 (container=4c7fba6e02cde90de1f7f1365134cc0a8ff98da889a0c8164f7f24e921b96f57, driver=local)
2016-08-24T15:59:26.937584336-04:00 container destroy 4c7fba6e02cde90de1f7f1365134cc0a8ff98da889a0c8164f7f24e921b96f57 (image=redis, name=r1)
r1