1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Use ListOpt for labels.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit 6c3b44f755)
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Daniel Nephin 2016-09-29 17:59:52 -04:00 committed by Victor Vieux
parent 64ae81609c
commit 458bd3663b

View file

@ -37,7 +37,7 @@ type buildOptions struct {
context string
dockerfileName string
tags opts.ListOpts
labels []string
labels opts.ListOpts
buildArgs opts.ListOpts
ulimits *runconfigopts.UlimitOpt
memory string
@ -64,6 +64,7 @@ func NewBuildCommand(dockerCli *client.DockerCli) *cobra.Command {
tags: opts.NewListOpts(validateTag),
buildArgs: opts.NewListOpts(runconfigopts.ValidateEnv),
ulimits: runconfigopts.NewUlimitOpt(&ulimits),
labels: opts.NewListOpts(runconfigopts.ValidateEnv),
}
cmd := &cobra.Command{
@ -92,7 +93,7 @@ func NewBuildCommand(dockerCli *client.DockerCli) *cobra.Command {
flags.StringVar(&options.cpuSetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)")
flags.StringVar(&options.cgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container")
flags.StringVar(&options.isolation, "isolation", "", "Container isolation technology")
flags.StringSliceVar(&options.labels, "label", []string{}, "Set metadata for an image")
flags.Var(&options.labels, "label", "Set metadata for an image")
flags.BoolVar(&options.noCache, "no-cache", false, "Do not use cache when building the image")
flags.BoolVar(&options.rm, "rm", true, "Remove intermediate containers after a successful build")
flags.BoolVar(&options.forceRm, "force-rm", false, "Always remove intermediate containers")
@ -264,7 +265,7 @@ func runBuild(dockerCli *client.DockerCli, options buildOptions) error {
Ulimits: options.ulimits.GetList(),
BuildArgs: runconfigopts.ConvertKVStringsToMap(options.buildArgs.GetAll()),
AuthConfigs: dockerCli.RetrieveAuthConfigs(),
Labels: runconfigopts.ConvertKVStringsToMap(options.labels),
Labels: runconfigopts.ConvertKVStringsToMap(options.labels.GetAll()),
}
response, err := dockerCli.Client().ImageBuild(ctx, body, buildOptions)