Browse code

Merge branch 'master' into bump_v0.11.1

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Michael Crosby authored on 2014/05/08 09:27:57
Showing 12 changed files
... ...
@@ -1 +1 @@
1
-0.11.0
1
+0.11.0-dev
... ...
@@ -872,6 +872,8 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
872 872
 		return fmt.Errorf("Multipart upload for build is no longer supported. Please upgrade your docker client.")
873 873
 	}
874 874
 	var (
875
+		authEncoded       = r.Header.Get("X-Registry-Auth")
876
+		authConfig        = &registry.AuthConfig{}
875 877
 		configFileEncoded = r.Header.Get("X-Registry-Config")
876 878
 		configFile        = &registry.ConfigFile{}
877 879
 		job               = eng.Job("build")
... ...
@@ -881,18 +883,12 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
881 881
 	// Both headers will be parsed and sent along to the daemon, but if a non-empty
882 882
 	// ConfigFile is present, any value provided as an AuthConfig directly will
883 883
 	// be overridden. See BuildFile::CmdFrom for details.
884
-	var (
885
-		authEncoded = r.Header.Get("X-Registry-Auth")
886
-		authConfig  = &registry.AuthConfig{}
887
-	)
888 884
 	if version.LessThan("1.9") && authEncoded != "" {
889 885
 		authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
890 886
 		if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
891 887
 			// for a pull it is not an error if no auth was given
892 888
 			// to increase compatibility with the existing api it is defaulting to be empty
893 889
 			authConfig = &registry.AuthConfig{}
894
-		} else {
895
-			configFile.Configs[authConfig.ServerAddress] = *authConfig
896 890
 		}
897 891
 	}
898 892
 
... ...
@@ -917,7 +913,8 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
917 917
 	job.Setenv("q", r.FormValue("q"))
918 918
 	job.Setenv("nocache", r.FormValue("nocache"))
919 919
 	job.Setenv("rm", r.FormValue("rm"))
920
-	job.SetenvJson("auth", configFile)
920
+	job.SetenvJson("authConfig", authConfig)
921
+	job.SetenvJson("configFile", configFile)
921 922
 
922 923
 	if err := job.Run(); err != nil {
923 924
 		if !job.Stdout.Used() {
... ...
@@ -43,7 +43,7 @@ usage() {
43 43
 debianStable=wheezy
44 44
 debianUnstable=sid
45 45
 # this should match the name found at http://releases.ubuntu.com/
46
-ubuntuLatestLTS=precise
46
+ubuntuLatestLTS=trusty
47 47
 # this should match the name found at http://releases.tanglu.org/
48 48
 tangluLatest=aequorea
49 49
 
... ...
@@ -43,11 +43,11 @@ func main() {
43 43
 		flDaemon             = flag.Bool([]string{"d", "-daemon"}, false, "Enable daemon mode")
44 44
 		flDebug              = flag.Bool([]string{"D", "-debug"}, false, "Enable debug mode")
45 45
 		flAutoRestart        = flag.Bool([]string{"r", "-restart"}, true, "Restart previously running containers")
46
-		bridgeName           = flag.String([]string{"b", "-bridge"}, "", "Attach containers to a pre-existing network bridge; use 'none' to disable container networking")
46
+		bridgeName           = flag.String([]string{"b", "-bridge"}, "", "Attach containers to a pre-existing network bridge\nuse 'none' to disable container networking")
47 47
 		bridgeIp             = flag.String([]string{"#bip", "-bip"}, "", "Use this CIDR notation address for the network bridge's IP, not compatible with -b")
48 48
 		pidfile              = flag.String([]string{"p", "-pidfile"}, "/var/run/docker.pid", "Path to use for daemon PID file")
49 49
 		flRoot               = flag.String([]string{"g", "-graph"}, "/var/lib/docker", "Path to use as the root of the docker runtime")
50
-		flSocketGroup        = flag.String([]string{"G", "-group"}, "docker", "Group to assign the unix socket specified by -H when running in daemon mode; use '' (the empty string) to disable setting of a group")
50
+		flSocketGroup        = flag.String([]string{"G", "-group"}, "docker", "Group to assign the unix socket specified by -H when running in daemon mode\nuse '' (the empty string) to disable setting of a group")
51 51
 		flEnableCors         = flag.Bool([]string{"#api-enable-cors", "-api-enable-cors"}, false, "Enable CORS headers in the remote API")
52 52
 		flDns                = opts.NewListOpts(opts.ValidateIp4Address)
53 53
 		flDnsSearch          = opts.NewListOpts(opts.ValidateDomain)
... ...
@@ -58,7 +58,7 @@ func main() {
58 58
 		flGraphDriver        = flag.String([]string{"s", "-storage-driver"}, "", "Force the docker runtime to use a specific storage driver")
59 59
 		flExecDriver         = flag.String([]string{"e", "-exec-driver"}, "native", "Force the docker runtime to use a specific exec driver")
60 60
 		flHosts              = opts.NewListOpts(api.ValidateHost)
61
-		flMtu                = flag.Int([]string{"#mtu", "-mtu"}, 0, "Set the containers network MTU; if no value is provided: default to the default route MTU or 1500 if no default route is available")
61
+		flMtu                = flag.Int([]string{"#mtu", "-mtu"}, 0, "Set the containers network MTU\nif no value is provided: default to the default route MTU or 1500 if no default route is available")
62 62
 		flTls                = flag.Bool([]string{"-tls"}, false, "Use TLS; implied by tls-verify flags")
63 63
 		flTlsVerify          = flag.Bool([]string{"-tlsverify"}, false, "Use TLS and verify the remote (daemon: verify client, client: verify daemon)")
64 64
 		flCa                 = flag.String([]string{"-tlscacert"}, dockerConfDir+defaultCaFile, "Trust only remotes providing a certificate signed by the CA given here")
... ...
@@ -68,7 +68,7 @@ func main() {
68 68
 	)
69 69
 	flag.Var(&flDns, []string{"#dns", "-dns"}, "Force docker to use specific DNS servers")
70 70
 	flag.Var(&flDnsSearch, []string{"-dns-search"}, "Force Docker to use specific DNS search domains")
71
-	flag.Var(&flHosts, []string{"H", "-host"}, "The socket(s) to bind to in daemon mode, specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.")
71
+	flag.Var(&flHosts, []string{"H", "-host"}, "The socket(s) to bind to in daemon mode\nspecified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.")
72 72
 
73 73
 	flag.Parse()
74 74
 
... ...
@@ -809,33 +809,39 @@ Run a command in a new container
809 809
 
810 810
     Usage: docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]
811 811
 
812
-    -a, --attach=[]: Attach to stdin, stdout or stderr.
813
-    -c, --cpu-shares=0: CPU shares (relative weight)
814
-    --cidfile="": Write the container ID to the file
815
-    -d, --detach=false: Detached mode: Run container in the background, print new container id
816
-    --dns=[]: Set custom dns servers
817
-    --dns-search=[]: Set custom dns search domains
818
-    -e, --env=[]: Set environment variables
819
-    --entrypoint="": Overwrite the default entrypoint of the image
820
-    --env-file=[]: Read in a line delimited file of ENV variables
821
-    --expose=[]: Expose a port from the container without publishing it to your host
822
-    -h, --hostname="": Container host name
823
-    -i, --interactive=false: Keep stdin open even if not attached
824
-    --link=[]: Add link to another container (name:alias)
825
-    --lxc-conf=[]: (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
826
-    -m, --memory="": Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
827
-    --name="": Assign a name to the container
828
-    --net="bridge": Set the Network mode for the container ('bridge': creates a new network stack for the container on the docker bridge, 'none': no networking for this container, 'container:<name|id>': reuses another container network stack), 'host': use the host network stack inside the container
829
-    -P, --publish-all=false: Publish all exposed ports to the host interfaces
830
-    -p, --publish=[]: Publish a container's port to the host (format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort) (use 'docker port' to see the actual mapping)
831
-    --privileged=false: Give extended privileges to this container
832
-    --rm=false: Automatically remove the container when it exits (incompatible with -d)
833
-    --sig-proxy=true: Proxify all received signal to the process (even in non-tty mode)
834
-    -t, --tty=false: Allocate a pseudo-tty
835
-    -u, --user="": Username or UID
836
-    -v, --volume=[]: Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)
837
-    --volumes-from=[]: Mount volumes from the specified container(s)
838
-    -w, --workdir="": Working directory inside the container
812
+    -a, --attach=[]            Attach to stdin, stdout or stderr.
813
+    -c, --cpu-shares=0         CPU shares (relative weight)
814
+    --cidfile=""               Write the container ID to the file
815
+    -d, --detach=false         Detached mode: Run container in the background, print new container id
816
+    --dns=[]                   Set custom dns servers
817
+    --dns-search=[]            Set custom dns search domains
818
+    -e, --env=[]               Set environment variables
819
+    --entrypoint=""            Overwrite the default entrypoint of the image
820
+    --env-file=[]              Read in a line delimited file of ENV variables
821
+    --expose=[]                Expose a port from the container without publishing it to your host
822
+    -h, --hostname=""          Container host name
823
+    -i, --interactive=false    Keep stdin open even if not attached
824
+    --link=[]                  Add link to another container (name:alias)
825
+    --lxc-conf=[]              (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
826
+    -m, --memory=""            Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
827
+    --name=""                  Assign a name to the container
828
+    --net="bridge"             Set the Network mode for the container
829
+                                 'bridge': creates a new network stack for the container on the docker bridge
830
+                                 'none': no networking for this container
831
+                                 'container:<name|id>': reuses another container network stack
832
+                                 'host': use the host network stack inside the contaner
833
+    -p, --publish=[]           Publish a container's port to the host
834
+                                 format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort
835
+                                 (use 'docker port' to see the actual mapping)
836
+    -P, --publish-all=false    Publish all exposed ports to the host interfaces
837
+    --privileged=false         Give extended privileges to this container
838
+    --rm=false                 Automatically remove the container when it exits (incompatible with -d)
839
+    --sig-proxy=true           Proxify all received signal to the process (even in non-tty mode)
840
+    -t, --tty=false            Allocate a pseudo-tty
841
+    -u, --user=""              Username or UID
842
+    -v, --volume=[]            Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)
843
+    --volumes-from=[]          Mount volumes from the specified container(s)
844
+    -w, --workdir=""           Working directory inside the container
839 845
 
840 846
 The `docker run` command first `creates` a writeable container layer over the
841 847
 specified image, and then `starts` it using the specified command. That is,
... ...
@@ -138,6 +138,11 @@ PID files):
138 138
 
139 139
     --dns=[]      : Set custom dns servers for the container
140 140
     --net="bridge": Set the Network mode for the container ('bridge': creates a new network stack for the container on the docker bridge, 'none': no networking for this container, 'container:<name|id>': reuses another container network stack), 'host': use the host network stack inside the container
141
+    --net="bridge"             Set the Network mode for the container
142
+                                 'bridge': creates a new network stack for the container on the docker bridge
143
+                                 'none': no networking for this container
144
+                                 'container:<name|id>': reuses another container network stack
145
+                                 'host': use the host network stack inside the contaner
141 146
 
142 147
 By default, all containers have networking enabled and they can make any
143 148
 outgoing connections. The operator can completely disable networking
... ...
@@ -394,7 +394,7 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u
394 394
 	}
395 395
 	dockerfile := constructDockerfile(context.dockerfile, ip, port)
396 396
 
397
-	buildfile := server.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, useCache, false, ioutil.Discard, utils.NewStreamFormatter(false), nil)
397
+	buildfile := server.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, useCache, false, ioutil.Discard, utils.NewStreamFormatter(false), nil, nil)
398 398
 	id, err := buildfile.Build(context.Archive(dockerfile, t))
399 399
 	if err != nil {
400 400
 		return nil, err
... ...
@@ -828,7 +828,7 @@ func TestForbiddenContextPath(t *testing.T) {
828 828
 	}
829 829
 	dockerfile := constructDockerfile(context.dockerfile, ip, port)
830 830
 
831
-	buildfile := server.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil)
831
+	buildfile := server.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil, nil)
832 832
 	_, err = buildfile.Build(context.Archive(dockerfile, t))
833 833
 
834 834
 	if err == nil {
... ...
@@ -874,7 +874,7 @@ func TestBuildADDFileNotFound(t *testing.T) {
874 874
 	}
875 875
 	dockerfile := constructDockerfile(context.dockerfile, ip, port)
876 876
 
877
-	buildfile := server.NewBuildFile(mkServerFromEngine(eng, t), ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil)
877
+	buildfile := server.NewBuildFile(mkServerFromEngine(eng, t), ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil, nil)
878 878
 	_, err = buildfile.Build(context.Archive(dockerfile, t))
879 879
 
880 880
 	if err == nil {
... ...
@@ -2,6 +2,7 @@ package main
2 2
 
3 3
 import (
4 4
 	"fmt"
5
+
5 6
 	flag "github.com/dotcloud/docker/pkg/mflag"
6 7
 )
7 8
 
... ...
@@ -19,15 +20,17 @@ func init() {
19 19
 	flag.IntVar(&i, []string{"-integer", "-number"}, -1, "a simple integer")
20 20
 	flag.StringVar(&str, []string{"s", "#hidden", "-string"}, "", "a simple string") //-s -hidden and --string will work, but -hidden won't be in the usage
21 21
 	flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help")
22
+	flag.StringVar(&str, []string{"mode"}, "mode1", "set the mode\nmode1: use the mode1\nmode2: use the mode2\nmode3: use the mode3")
22 23
 	flag.Parse()
23 24
 }
24 25
 func main() {
25 26
 	if h {
26 27
 		flag.PrintDefaults()
28
+	} else {
29
+		fmt.Printf("s/#hidden/-string: %s\n", str)
30
+		fmt.Printf("b: %b\n", b)
31
+		fmt.Printf("-bool: %b\n", b2)
32
+		fmt.Printf("s/#hidden/-string(via lookup): %s\n", flag.Lookup("s").Value.String())
33
+		fmt.Printf("ARGS: %v\n", flag.Args())
27 34
 	}
28
-	fmt.Printf("s/#hidden/-string: %s\n", str)
29
-	fmt.Printf("b: %b\n", b)
30
-	fmt.Printf("-bool: %b\n", b2)
31
-	fmt.Printf("s/#hidden/-string(via lookup): %s\n", flag.Lookup("s").Value.String())
32
-	fmt.Printf("ARGS: %v\n", flag.Args())
33 35
 }
... ...
@@ -83,6 +83,7 @@ import (
83 83
 	"sort"
84 84
 	"strconv"
85 85
 	"strings"
86
+	"text/tabwriter"
86 87
 	"time"
87 88
 )
88 89
 
... ...
@@ -419,11 +420,12 @@ func Set(name, value string) error {
419 419
 // PrintDefaults prints, to standard error unless configured
420 420
 // otherwise, the default values of all defined flags in the set.
421 421
 func (f *FlagSet) PrintDefaults() {
422
+	writer := tabwriter.NewWriter(f.out(), 20, 1, 3, ' ', 0)
422 423
 	f.VisitAll(func(flag *Flag) {
423
-		format := "  -%s=%s: %s\n"
424
+		format := "  -%s=%s"
424 425
 		if _, ok := flag.Value.(*stringValue); ok {
425 426
 			// put quotes on the value
426
-			format = "  -%s=%q: %s\n"
427
+			format = "  -%s=%q"
427 428
 		}
428 429
 		names := []string{}
429 430
 		for _, name := range flag.Names {
... ...
@@ -432,9 +434,18 @@ func (f *FlagSet) PrintDefaults() {
432 432
 			}
433 433
 		}
434 434
 		if len(names) > 0 {
435
-			fmt.Fprintf(f.out(), format, strings.Join(names, ", -"), flag.DefValue, flag.Usage)
435
+			fmt.Fprintf(writer, format, strings.Join(names, ", -"), flag.DefValue)
436
+			for i, line := range strings.Split(flag.Usage, "\n") {
437
+				if i != 0 {
438
+					line = "  " + line
439
+				}
440
+				fmt.Fprintln(writer, "\t", line)
441
+			}
442
+			//			start := fmt.Sprintf(format, strings.Join(names, ", -"), flag.DefValue)
443
+			//			fmt.Fprintln(f.out(), start, strings.Replace(flag.Usage, "\n", "\n"+strings.Repeat(" ", len(start)+1), -1))
436 444
 		}
437 445
 	})
446
+	writer.Flush()
438 447
 }
439 448
 
440 449
 // PrintDefaults prints to standard error the default values of all defined command-line flags.
... ...
@@ -14,7 +14,7 @@ import (
14 14
 )
15 15
 
16 16
 var (
17
-	ErrInvalidWorikingDirectory = fmt.Errorf("The working directory is invalid. It needs to be an absolute path.")
17
+	ErrInvalidWorkingDirectory  = fmt.Errorf("The working directory is invalid. It needs to be an absolute path.")
18 18
 	ErrConflictAttachDetach     = fmt.Errorf("Conflicting options: -a and -d")
19 19
 	ErrConflictDetachAutoRemove = fmt.Errorf("Conflicting options: --rm and -d")
20 20
 )
... ...
@@ -62,7 +62,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
62 62
 		flUser            = cmd.String([]string{"u", "-user"}, "", "Username or UID")
63 63
 		flWorkingDir      = cmd.String([]string{"w", "-workdir"}, "", "Working directory inside the container")
64 64
 		flCpuShares       = cmd.Int64([]string{"c", "-cpu-shares"}, 0, "CPU shares (relative weight)")
65
-		flNetMode         = cmd.String([]string{"-net"}, "bridge", "Set the Network mode for the container ('bridge': creates a new network stack for the container on the docker bridge, 'none': no networking for this container, 'container:<name|id>': reuses another container network stack), 'host': use the host network stack inside the container")
65
+		flNetMode         = cmd.String([]string{"-net"}, "bridge", "Set the Network mode for the container\n'bridge': creates a new network stack for the container on the docker bridge\n'none': no networking for this container\n'container:<name|id>': reuses another container network stack\n'host': use the host network stack inside the contaner")
66 66
 		// For documentation purpose
67 67
 		_ = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxify all received signal to the process (even in non-tty mode)")
68 68
 		_ = cmd.String([]string{"#name", "-name"}, "", "Assign a name to the container")
... ...
@@ -74,7 +74,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
74 74
 	cmd.Var(&flEnv, []string{"e", "-env"}, "Set environment variables")
75 75
 	cmd.Var(&flEnvFile, []string{"-env-file"}, "Read in a line delimited file of ENV variables")
76 76
 
77
-	cmd.Var(&flPublish, []string{"p", "-publish"}, fmt.Sprintf("Publish a container's port to the host (format: %s) (use 'docker port' to see the actual mapping)", nat.PortSpecTemplateFormat))
77
+	cmd.Var(&flPublish, []string{"p", "-publish"}, fmt.Sprintf("Publish a container's port to the host\nformat: %s\n(use 'docker port' to see the actual mapping)", nat.PortSpecTemplateFormat))
78 78
 	cmd.Var(&flExpose, []string{"#expose", "-expose"}, "Expose a port from the container without publishing it to your host")
79 79
 	cmd.Var(&flDns, []string{"#dns", "-dns"}, "Set custom dns servers")
80 80
 	cmd.Var(&flDnsSearch, []string{"-dns-search"}, "Set custom dns search domains")
... ...
@@ -95,7 +95,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
95 95
 		return nil, nil, cmd, ErrConflictAttachDetach
96 96
 	}
97 97
 	if *flWorkingDir != "" && !path.IsAbs(*flWorkingDir) {
98
-		return nil, nil, cmd, ErrInvalidWorikingDirectory
98
+		return nil, nil, cmd, ErrInvalidWorkingDirectory
99 99
 	}
100 100
 	if *flDetach && *flAutoRemove {
101 101
 		return nil, nil, cmd, ErrConflictDetachAutoRemove
... ...
@@ -50,6 +50,7 @@ type buildFile struct {
50 50
 	utilizeCache bool
51 51
 	rm           bool
52 52
 
53
+	authConfig *registry.AuthConfig
53 54
 	configFile *registry.ConfigFile
54 55
 
55 56
 	tmpContainers map[string]struct{}
... ...
@@ -80,10 +81,20 @@ func (b *buildFile) CmdFrom(name string) error {
80 80
 	if err != nil {
81 81
 		if b.daemon.Graph().IsNotExist(err) {
82 82
 			remote, tag := utils.ParseRepositoryTag(name)
83
+			pullRegistryAuth := b.authConfig
84
+			if len(b.configFile.Configs) > 0 {
85
+				// The request came with a full auth config file, we prefer to use that
86
+				endpoint, _, err := registry.ResolveRepositoryName(remote)
87
+				if err != nil {
88
+					return err
89
+				}
90
+				resolvedAuth := b.configFile.ResolveAuthConfig(endpoint)
91
+				pullRegistryAuth = &resolvedAuth
92
+			}
83 93
 			job := b.srv.Eng.Job("pull", remote, tag)
84 94
 			job.SetenvBool("json", b.sf.Json())
85 95
 			job.SetenvBool("parallel", true)
86
-			job.SetenvJson("auth", b.configFile)
96
+			job.SetenvJson("authConfig", pullRegistryAuth)
87 97
 			job.Stdout.Add(b.outOld)
88 98
 			if err := job.Run(); err != nil {
89 99
 				return err
... ...
@@ -821,7 +832,7 @@ func stripComments(raw []byte) string {
821 821
 	return strings.Join(out, "\n")
822 822
 }
823 823
 
824
-func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeCache, rm bool, outOld io.Writer, sf *utils.StreamFormatter, configFile *registry.ConfigFile) BuildFile {
824
+func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeCache, rm bool, outOld io.Writer, sf *utils.StreamFormatter, auth *registry.AuthConfig, authConfigFile *registry.ConfigFile) BuildFile {
825 825
 	return &buildFile{
826 826
 		daemon:        srv.daemon,
827 827
 		srv:           srv,
... ...
@@ -834,7 +845,8 @@ func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeC
834 834
 		utilizeCache:  utilizeCache,
835 835
 		rm:            rm,
836 836
 		sf:            sf,
837
-		configFile:    configFile,
837
+		authConfig:    auth,
838
+		configFile:    authConfigFile,
838 839
 		outOld:        outOld,
839 840
 	}
840 841
 }
... ...
@@ -428,11 +428,13 @@ func (srv *Server) Build(job *engine.Job) engine.Status {
428 428
 		suppressOutput = job.GetenvBool("q")
429 429
 		noCache        = job.GetenvBool("nocache")
430 430
 		rm             = job.GetenvBool("rm")
431
+		authConfig     = &registry.AuthConfig{}
431 432
 		configFile     = &registry.ConfigFile{}
432 433
 		tag            string
433 434
 		context        io.ReadCloser
434 435
 	)
435
-	job.GetenvJson("auth", configFile)
436
+	job.GetenvJson("authConfig", authConfig)
437
+	job.GetenvJson("configFile", configFile)
436 438
 	repoName, tag = utils.ParseRepositoryTag(repoName)
437 439
 
438 440
 	if remoteURL == "" {
... ...
@@ -484,7 +486,7 @@ func (srv *Server) Build(job *engine.Job) engine.Status {
484 484
 			Writer:          job.Stdout,
485 485
 			StreamFormatter: sf,
486 486
 		},
487
-		!suppressOutput, !noCache, rm, job.Stdout, sf, configFile)
487
+		!suppressOutput, !noCache, rm, job.Stdout, sf, authConfig, configFile)
488 488
 	id, err := b.Build(context)
489 489
 	if err != nil {
490 490
 		return job.Error(err)
... ...
@@ -1341,23 +1343,16 @@ func (srv *Server) ImagePull(job *engine.Job) engine.Status {
1341 1341
 		localName   = job.Args[0]
1342 1342
 		tag         string
1343 1343
 		sf          = utils.NewStreamFormatter(job.GetenvBool("json"))
1344
-		authConfig  registry.AuthConfig
1345
-		configFile  = &registry.ConfigFile{}
1344
+		authConfig  = &registry.AuthConfig{}
1346 1345
 		metaHeaders map[string][]string
1347 1346
 	)
1348 1347
 	if len(job.Args) > 1 {
1349 1348
 		tag = job.Args[1]
1350 1349
 	}
1351 1350
 
1352
-	job.GetenvJson("auth", configFile)
1351
+	job.GetenvJson("authConfig", authConfig)
1353 1352
 	job.GetenvJson("metaHeaders", metaHeaders)
1354 1353
 
1355
-	endpoint, _, err := registry.ResolveRepositoryName(localName)
1356
-	if err != nil {
1357
-		return job.Error(err)
1358
-	}
1359
-	authConfig = configFile.ResolveAuthConfig(endpoint)
1360
-
1361 1354
 	c, err := srv.poolAdd("pull", localName+":"+tag)
1362 1355
 	if err != nil {
1363 1356
 		if c != nil {
... ...
@@ -1376,12 +1371,12 @@ func (srv *Server) ImagePull(job *engine.Job) engine.Status {
1376 1376
 		return job.Error(err)
1377 1377
 	}
1378 1378
 
1379
-	endpoint, err = registry.ExpandAndVerifyRegistryUrl(hostname)
1379
+	endpoint, err := registry.ExpandAndVerifyRegistryUrl(hostname)
1380 1380
 	if err != nil {
1381 1381
 		return job.Error(err)
1382 1382
 	}
1383 1383
 
1384
-	r, err := registry.NewRegistry(&authConfig, registry.HTTPRequestFactory(metaHeaders), endpoint)
1384
+	r, err := registry.NewRegistry(authConfig, registry.HTTPRequestFactory(metaHeaders), endpoint)
1385 1385
 	if err != nil {
1386 1386
 		return job.Error(err)
1387 1387
 	}