|
@@ -6,7 +6,6 @@ import (
|
|
"io"
|
|
"io"
|
|
"net/http"
|
|
"net/http"
|
|
"net/url"
|
|
"net/url"
|
|
- "regexp"
|
|
|
|
"strconv"
|
|
"strconv"
|
|
|
|
|
|
"golang.org/x/net/context"
|
|
"golang.org/x/net/context"
|
|
@@ -15,8 +14,6 @@ import (
|
|
"github.com/docker/docker/api/types/container"
|
|
"github.com/docker/docker/api/types/container"
|
|
)
|
|
)
|
|
|
|
|
|
-var headerRegexp = regexp.MustCompile(`\ADocker/.+\s\((.+)\)\z`)
|
|
|
|
-
|
|
|
|
// ImageBuild sends request to the daemon to build images.
|
|
// ImageBuild sends request to the daemon to build images.
|
|
// The Body in the response implement an io.ReadCloser and it's up to the caller to
|
|
// The Body in the response implement an io.ReadCloser and it's up to the caller to
|
|
// close it.
|
|
// close it.
|
|
@@ -39,7 +36,7 @@ func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, optio
|
|
return types.ImageBuildResponse{}, err
|
|
return types.ImageBuildResponse{}, err
|
|
}
|
|
}
|
|
|
|
|
|
- osType := GetDockerOS(serverResp.header.Get("Server"))
|
|
|
|
|
|
+ osType := getDockerOS(serverResp.header.Get("Server"))
|
|
|
|
|
|
return types.ImageBuildResponse{
|
|
return types.ImageBuildResponse{
|
|
Body: serverResp.body,
|
|
Body: serverResp.body,
|
|
@@ -124,13 +121,3 @@ func (cli *Client) imageBuildOptionsToQuery(options types.ImageBuildOptions) (ur
|
|
|
|
|
|
return query, nil
|
|
return query, nil
|
|
}
|
|
}
|
|
-
|
|
|
|
-// GetDockerOS returns the operating system based on the server header from the daemon.
|
|
|
|
-func GetDockerOS(serverHeader string) string {
|
|
|
|
- var osType string
|
|
|
|
- matches := headerRegexp.FindStringSubmatch(serverHeader)
|
|
|
|
- if len(matches) > 0 {
|
|
|
|
- osType = matches[1]
|
|
|
|
- }
|
|
|
|
- return osType
|
|
|
|
-}
|
|
|