Merge pull request #864 from rjnagal/docker

Fix network info for docker containers running with --net=host.
This commit is contained in:
Victor Marmol 2015-08-24 08:31:57 -07:00
commit 27fb6d593c

View File

@ -167,7 +167,16 @@ func libcontainerConfigToContainerSpec(config *libcontainerConfigs.Config, mi *i
} }
spec.Cpu.Mask = utils.FixCpuMask(config.Cgroups.CpusetCpus, mi.NumCores) spec.Cpu.Mask = utils.FixCpuMask(config.Cgroups.CpusetCpus, mi.NumCores)
spec.HasNetwork = len(config.Networks) > 0 // Docker reports a loop device for containers with --net=host. Ignore
// those too.
networkCount := 0
for _, n := range config.Networks {
if n.Type != "loopback" {
networkCount += 1
}
}
spec.HasNetwork = networkCount > 0
spec.HasDiskIo = true spec.HasDiskIo = true
return spec return spec