Browse code

[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 <josh.hawn@docker.com> (github: jlhawn)

Josh Hawn authored on 2015/07/28 03:08:40
Showing 1 changed files
... ...
@@ -877,10 +877,26 @@ COPY . /static`); err != nil {
877 877
 		return nil, fmt.Errorf("failed to find container port: err=%v\nout=%s", err, out)
878 878
 	}
879 879
 
880
+	fileserverHostPort := strings.Trim(out, "\n")
881
+	_, port, err := net.SplitHostPort(fileserverHostPort)
882
+	if err != nil {
883
+		return nil, fmt.Errorf("unable to parse file server host:port: %v", err)
884
+	}
885
+
886
+	dockerHostURL, err := url.Parse(daemonHost())
887
+	if err != nil {
888
+		return nil, fmt.Errorf("unable to parse daemon host URL: %v", err)
889
+	}
890
+
891
+	host, _, err := net.SplitHostPort(dockerHostURL.Host)
892
+	if err != nil {
893
+		return nil, fmt.Errorf("unable to parse docker daemon host:port: %v", err)
894
+	}
895
+
880 896
 	return &remoteFileServer{
881 897
 		container: container,
882 898
 		image:     image,
883
-		host:      strings.Trim(out, "\n"),
899
+		host:      fmt.Sprintf("%s:%s", host, port),
884 900
 		ctx:       ctx}, nil
885 901
 }
886 902