summaryrefslogtreecommitdiff
path: root/vendor/github.com/fsouza/go-dockerclient/image.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/image.go')
-rw-r--r--vendor/github.com/fsouza/go-dockerclient/image.go40
1 files changed, 16 insertions, 24 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/image.go b/vendor/github.com/fsouza/go-dockerclient/image.go
index 124e78da3..f9e1c6f04 100644
--- a/vendor/github.com/fsouza/go-dockerclient/image.go
+++ b/vendor/github.com/fsouza/go-dockerclient/image.go
@@ -5,7 +5,6 @@
package docker
import (
- "bytes"
"context"
"encoding/base64"
"encoding/json"
@@ -445,15 +444,10 @@ func (c *Client) ImportImage(opts ImportImageOptions) error {
// For more details about the Docker building process, see
// https://goo.gl/4nYHwV.
type BuildImageOptions struct {
+ Context context.Context
Name string `qs:"t"`
Dockerfile string `qs:"dockerfile"`
- NoCache bool `qs:"nocache"`
CacheFrom []string `qs:"-"`
- SuppressOutput bool `qs:"q"`
- Pull bool `qs:"pull"`
- RmTmpContainer bool `qs:"rm"`
- ForceRmTmpContainer bool `qs:"forcerm"`
- RawJSONStream bool `qs:"-"`
Memory int64 `qs:"memory"`
Memswap int64 `qs:"memswap"`
CPUShares int64 `qs:"cpushares"`
@@ -474,7 +468,12 @@ type BuildImageOptions struct {
CgroupParent string `qs:"cgroupparent"`
SecurityOpt []string `qs:"securityopt"`
Target string `gs:"target"`
- Context context.Context
+ NoCache bool `qs:"nocache"`
+ SuppressOutput bool `qs:"q"`
+ Pull bool `qs:"pull"`
+ RmTmpContainer bool `qs:"rm"`
+ ForceRmTmpContainer bool `qs:"forcerm"`
+ RawJSONStream bool `qs:"-"`
}
// BuildArg represents arguments that can be passed to the image when building
@@ -558,7 +557,7 @@ func (c *Client) BuildImage(opts BuildImageOptions) error {
})
}
-func (c *Client) versionedAuthConfigs(authConfigs AuthConfigurations) interface{} {
+func (c *Client) versionedAuthConfigs(authConfigs AuthConfigurations) registryAuth {
if c.serverAPIVersion == nil {
c.checkAPIVersion()
}
@@ -588,7 +587,6 @@ func (c *Client) TagImage(name string, opts TagImageOptions) error {
resp, err := c.do("POST", "/images/"+name+"/tag?"+queryString(&opts), doOptions{
context: opts.Context,
})
-
if err != nil {
return err
}
@@ -610,24 +608,18 @@ func isURL(u string) bool {
return p.Scheme == "http" || p.Scheme == "https"
}
-func headersWithAuth(auths ...interface{}) (map[string]string, error) {
+func headersWithAuth(auths ...registryAuth) (map[string]string, error) {
var headers = make(map[string]string)
for _, auth := range auths {
- switch auth.(type) {
- case AuthConfiguration:
- var buf bytes.Buffer
- if err := json.NewEncoder(&buf).Encode(auth); err != nil {
- return nil, err
- }
- headers["X-Registry-Auth"] = base64.URLEncoding.EncodeToString(buf.Bytes())
- case AuthConfigurations, AuthConfigurations119:
- var buf bytes.Buffer
- if err := json.NewEncoder(&buf).Encode(auth); err != nil {
- return nil, err
- }
- headers["X-Registry-Config"] = base64.URLEncoding.EncodeToString(buf.Bytes())
+ if auth.isEmpty() {
+ continue
+ }
+ data, err := json.Marshal(auth)
+ if err != nil {
+ return nil, err
}
+ headers[auth.headerKey()] = base64.URLEncoding.EncodeToString(data)
}
return headers, nil