Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit 6c3b44f755cbf2564171a012fc55942862f3ede9)
Signed-off-by: Victor Vieux <vieux@docker.com>
... | ... |
@@ -37,7 +37,7 @@ type buildOptions struct { |
37 | 37 |
context string |
38 | 38 |
dockerfileName string |
39 | 39 |
tags opts.ListOpts |
40 |
- labels []string |
|
40 |
+ labels opts.ListOpts |
|
41 | 41 |
buildArgs opts.ListOpts |
42 | 42 |
ulimits *runconfigopts.UlimitOpt |
43 | 43 |
memory string |
... | ... |
@@ -64,6 +64,7 @@ func NewBuildCommand(dockerCli *client.DockerCli) *cobra.Command { |
64 | 64 |
tags: opts.NewListOpts(validateTag), |
65 | 65 |
buildArgs: opts.NewListOpts(runconfigopts.ValidateEnv), |
66 | 66 |
ulimits: runconfigopts.NewUlimitOpt(&ulimits), |
67 |
+ labels: opts.NewListOpts(runconfigopts.ValidateEnv), |
|
67 | 68 |
} |
68 | 69 |
|
69 | 70 |
cmd := &cobra.Command{ |
... | ... |
@@ -92,7 +93,7 @@ func NewBuildCommand(dockerCli *client.DockerCli) *cobra.Command { |
92 | 92 |
flags.StringVar(&options.cpuSetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)") |
93 | 93 |
flags.StringVar(&options.cgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container") |
94 | 94 |
flags.StringVar(&options.isolation, "isolation", "", "Container isolation technology") |
95 |
- flags.StringSliceVar(&options.labels, "label", []string{}, "Set metadata for an image") |
|
95 |
+ flags.Var(&options.labels, "label", "Set metadata for an image") |
|
96 | 96 |
flags.BoolVar(&options.noCache, "no-cache", false, "Do not use cache when building the image") |
97 | 97 |
flags.BoolVar(&options.rm, "rm", true, "Remove intermediate containers after a successful build") |
98 | 98 |
flags.BoolVar(&options.forceRm, "force-rm", false, "Always remove intermediate containers") |
... | ... |
@@ -264,7 +265,7 @@ func runBuild(dockerCli *client.DockerCli, options buildOptions) error { |
264 | 264 |
Ulimits: options.ulimits.GetList(), |
265 | 265 |
BuildArgs: runconfigopts.ConvertKVStringsToMap(options.buildArgs.GetAll()), |
266 | 266 |
AuthConfigs: dockerCli.RetrieveAuthConfigs(), |
267 |
- Labels: runconfigopts.ConvertKVStringsToMap(options.labels), |
|
267 |
+ Labels: runconfigopts.ConvertKVStringsToMap(options.labels.GetAll()), |
|
268 | 268 |
} |
269 | 269 |
|
270 | 270 |
response, err := dockerCli.Client().ImageBuild(ctx, body, buildOptions) |