Fix host Docker network

Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
Emile Vauge 2016-07-05 11:16:47 +02:00
parent 6e5a221180
commit 050416224d
No known key found for this signature in database
GPG key ID: D808B4C167352E59

View file

@ -270,7 +270,12 @@ func (provider *Docker) getIPAddress(container dockertypes.ContainerJSON) string
}
}
}
for _, network := range container.NetworkSettings.Networks {
for networkName, network := range container.NetworkSettings.Networks {
// If net==host, quick n' dirty, we return 127.0.0.1
// This will work locally, but will fail with swarm.
if "host" == networkName {
return "127.0.0.1"
}
return network.IPAddress
}
return ""