fix issue with hostname

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux 2015-01-15 23:10:07 +00:00
parent 29df40f95f
commit 01633efaa0
1 changed files with 7 additions and 6 deletions

View File

@ -55,17 +55,18 @@ type Node struct {
// Connect will initialize a connection to the Docker daemon running on the
// host, gather machine specs (memory, cpu, ...) and monitor state changes.
func (n *Node) Connect(config *tls.Config) error {
c, err := dockerclient.NewDockerClientTimeout(n.Addr, config, time.Duration(requestTimeout))
if err != nil {
return err
}
addr, err := net.ResolveIPAddr("ip4", strings.Split(c.URL.Host, ":")[0])
parts := strings.Split(n.Addr, ":")
addr, err := net.ResolveIPAddr("ip4", parts[0])
if err != nil {
return err
}
n.IP = addr.IP.String()
c, err := dockerclient.NewDockerClientTimeout(n.IP+":"+parts[1], config, time.Duration(requestTimeout))
if err != nil {
return err
}
return n.connectClient(c)
}