mcollina / docker-allcontainers

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

Starting container not listed in all-containers #8

Closed megastef closed 8 years ago

megastef commented 8 years ago

Hi, we use docker-loghose and some other modules depending on "allcontainers" (in Sematext Docker Agent collecting logs, events and metrics). During release tests we found out that all containers are reported but NOT the sematext-agent itself, which is just starting. During startup we attach to all containers... We have not changed any relevant code, so I came here to see if there is any change. In the past it was no problem to discover all containers (regardless of state ...).

Log output from Sematext Docker Agent during startup:

Docker Event: attach httpd  image:httpd, name:cranky_lovelace
Docker Event: attach httpd  image:httpd, name:naughty_payne

And docker ps

Stefans-MacBook-Pro:sematext-agent-docker stefan$ docker ps
CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS                  NAMES
02e2f8c209dc        sematext/sematext-agent-docker:1.30.1   "/sbin/tini -- run-se"   15 minutes ago      Up 15 minutes       9000/tcp               sematext-agent
910b593b1afa        httpd                                   "httpd-foreground"       2 days ago          Up 2 days           0.0.0.0:9888->80/tcp   cranky_lovelace
8eacc4f53298        httpd                                   "httpd-foreground"       2 days ago          Up 2 days           80/tcp                 naughty_payne

Even hours later there was never an event to attach to 'sematext-agent'.

Are you sure that the latest pull-request https://github.com/mcollina/docker-allcontainers/pull/7 covers all states? See diagram from Docker documentation: image

megastef commented 8 years ago

ping @boucher

megastef commented 8 years ago

Hi, sorry I might be wrong here. I see the changes are not published on npm yet - so the last PR is probably not the reason. I have to check with different Docker Version, currently using Docker for Mac Version 1.11.1-beta14 (build: 8670). I'll update this issue after more tests with other Docker versions.

mcollina commented 8 years ago

Let me know if anyone needs npm access on this.

boucher commented 8 years ago

I kind of doubt this is related to my pull request, which was specifically about paused containers. It might be useful to try and prepend your logs with timestamps, and run the daemon in debug mode, and then try to figure out the exact order that things are happening in. An interesting very simple test might be to try creating your allcontainers instance in a timeout like 30 seconds after startup and see if the behavior is the same.

megastef commented 8 years ago

I can't reproduce it on Linux - so probably my local setup on the MacBook. Closing the issue. Sorry.

megastef commented 8 years ago

FYI: There have been at least 2 issues: 1) I think this was the problem, missing events on fast start/stop of several containers: https://github.com/mcollina/docker-allcontainers/issues/9 2) A different issue: https://github.com/pelger/docker-stats/issues/9