have any function to exclude some CONTAINER use CONTAINER NAME or CONTAINER ID?
forgive me my poor english. I am in this situation , i use docker-gen and filebeat to collect docker logs . i use mesos marathon cluster,so the docker is dynamic state. docker-gen and filebeat is Container on every physical machine ,so every time the docker state changed ,i use docker-gen notify filebeat to restart.
docker run -d --restart=always --name docker-gen \
-v `pwd`:/etc/filebeat \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
-v `pwd`/templates:/etc/docker-gen/templates \
-t harbor.lamic.cn/base/docker-gen:with-curl -notify "curl --no-buffer -s -XPOST http://`ifconfig eth0 |grep 'inet'|awk '{print $2}'`:2375/containers/filebeat/restart" -notify-output -watch /etc/docker-gen/templates/filebeat.tmpl /etc/filebeat/filebeat.yml
this situation will cause filebeat restart always.is there any function to exclude filebeat Container ,so that docker-gen docker monitor filebeat Container state. Have any function to exclude some CONTAINER use CONTAINER NAME or CONTAINER ID?thanks.
You can now exclude a container by name in the template with whereNot, e.g. {{ range whereNot $ "Name" "filebeat" }}…{{ end }} (or whereLabelDoesNotExist for a drain label). Once the container is excluded from the rendered output, its own restart no longer changes that output, so the notify short-circuit (GenerateFile only fires the notify when the content actually changed) breaks the restart loop. Note the short-circuit alone isn't enough — you have to exclude the container from the template for its restart to be a no-op. Seems safe to close.