Skip to content

Commit c0d6a61

Browse files
authored
Add the Version field to BuildImageOptions (#961)
The `Version` field was added in API 1.39, though at the time the only known value was "1" ("classic" docker build). API 1.42 added "2" to identify the newer BuildKit-based builder. Signed-off-by: Nalin Dahyabhai <[email protected]>
1 parent e65de72 commit c0d6a61

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

image.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,14 @@ func (c *Client) ImportImage(opts ImportImageOptions) error {
469469
return c.createImage(&opts, nil, opts.InputStream, opts.OutputStream, opts.RawJSONStream, opts.InactivityTimeout, opts.Context)
470470
}
471471

472+
// BuilderVersion represents either the BuildKit or V1 ("classic") builder.
473+
type BuilderVersion string
474+
475+
const (
476+
BuilderV1 BuilderVersion = "1"
477+
BuilderBuildKit BuilderVersion = "2"
478+
)
479+
472480
// BuildImageOptions present the set of informations available for building an
473481
// image from a tarfile with a Dockerfile in it.
474482
//
@@ -504,11 +512,12 @@ type BuildImageOptions struct {
504512
Target string
505513
Outputs string `ver:"1.40"`
506514
NoCache bool
507-
SuppressOutput bool `qs:"q"`
508-
Pull bool `ver:"1.16"`
509-
RmTmpContainer bool `qs:"rm"`
510-
ForceRmTmpContainer bool `qs:"forcerm" ver:"1.12"`
511-
RawJSONStream bool `qs:"-"`
515+
SuppressOutput bool `qs:"q"`
516+
Pull bool `ver:"1.16"`
517+
RmTmpContainer bool `qs:"rm"`
518+
ForceRmTmpContainer bool `qs:"forcerm" ver:"1.12"`
519+
RawJSONStream bool `qs:"-"`
520+
Version BuilderVersion `qs:"version" ver:"1.39"`
512521
}
513522

514523
// BuildArg represents arguments that can be passed to the image when building

0 commit comments

Comments
 (0)