Cleanup service db for the network

Cleanup the service db for the network when the last
container on the network leaves on the host. This is
because we stop watching the network after the last
container leaves and so if we keep the service db
around it might be kept uptodate with containers
joining and leaving in other hosts. The service
db will populated properly when a container joins
this network at a later point in time.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
Jana Radhakrishnan 2015-10-24 17:41:58 -07:00
parent 38270b30b4
commit e5b34e1435
1 changed files with 5 additions and 0 deletions

View File

@ -367,6 +367,11 @@ func (c *controller) processEndpointDelete(nmap map[string]*netWatch, ep *endpoi
c.Lock()
if len(nw.localEps) == 0 {
close(nw.stopCh)
// This is the last container going away for the network. Destroy
// this network's svc db entry
delete(c.svcDb, ep.getNetwork().ID())
delete(nmap, ep.getNetwork().ID())
}
}