Port filtering: Fixed a race condition.

Port filtering used to rely on NetworkSettings, however, those are not
populated until the container is started. While stopped, the filter was
unaware of the port being used, resulting in a race condition.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2014-12-02 17:45:03 -08:00
parent ad5040c9f4
commit f5827052a4
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ func (p *PortFilter) Filter(config *dockerclient.ContainerConfig, nodes []*clust
func (p *PortFilter) portAlreadyInUse(node *cluster.Node, requested dockerclient.PortBinding) bool {
for _, c := range node.Containers() {
for _, port := range c.Info.NetworkSettings.Ports {
for _, port := range c.Info.HostConfig.PortBindings {
for _, binding := range port {
if binding.HostPort == requested.HostPort {
// Another container on the same host is binding on the same