From d06ffd0a5f5d55dacc369fc6560316e9f17e2cac Mon Sep 17 00:00:00 2001 From: Josh Hawn Date: Mon, 27 Jul 2015 11:08:40 -0700 Subject: [PATCH] [integration-cli] fix windows build test cases Use the same IP as the DOCKER_HOST when making a remote file server. Docker-DCO-1.1-Signed-off-by: Josh Hawn (github: jlhawn) --- integration-cli/docker_utils.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/integration-cli/docker_utils.go b/integration-cli/docker_utils.go index fb5ce2d37..65bd83b04 100644 --- a/integration-cli/docker_utils.go +++ b/integration-cli/docker_utils.go @@ -877,10 +877,26 @@ COPY . /static`); err != nil { return nil, fmt.Errorf("failed to find container port: err=%v\nout=%s", err, out) } + fileserverHostPort := strings.Trim(out, "\n") + _, port, err := net.SplitHostPort(fileserverHostPort) + if err != nil { + return nil, fmt.Errorf("unable to parse file server host:port: %v", err) + } + + dockerHostURL, err := url.Parse(daemonHost()) + if err != nil { + return nil, fmt.Errorf("unable to parse daemon host URL: %v", err) + } + + host, _, err := net.SplitHostPort(dockerHostURL.Host) + if err != nil { + return nil, fmt.Errorf("unable to parse docker daemon host:port: %v", err) + } + return &remoteFileServer{ container: container, image: image, - host: strings.Trim(out, "\n"), + host: fmt.Sprintf("%s:%s", host, port), ctx: ctx}, nil }