Skip to content

Race condition in -watch #57

@mhsmith

Description

@mhsmith

We are using docker-gen in this dynamic DNS server: https://github.com/ncarlier/dockerfiles/tree/master/dnsmasq. This requires that the DNS configuration is updated when docker-gen is started, and whenever containers are started and stopped thereafter. Unfortunately, there is a gap between the initial update and the point where docker-gen starts watching for events, as shown in this log:

2015-02-11 18:45:42,946 INFO spawned: 'docker-gen' with pid 9
2015-02-11 18:45:43,001 INFO spawned: 'dnsmasq' with pid 10
2015/02/11 18:45:43 Generated '/etc/dnsmasq.conf' from 4 containers
2015/02/11 18:45:43 Running 'supervisorctl restart dnsmasq'
[...]
2015/02/11 18:45:45 Watching docker events

Any containers started during that 2-second window will not appear in DNS until the next docker event, which may be an indefinite period of time.

Solution: docker-gen should start watching for events before its initial update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions