Skip to content

Commit 72e7b37

Browse files
Allow overriding default --load flag with --no-load
1 parent e1aaf20 commit 72e7b37

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/cmd/build/build.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func NewCmdBuild() *cobra.Command {
5454
os.Exit(1)
5555
}
5656

57-
// If neither --load or --push is specified, we default to --load
58-
if !options.exportLoad && !options.exportPush && len(options.outputs) == 0 {
57+
// If neither --load or --push is specified, we default to --load (unless --no-load is specified)
58+
if !options.noLoad && !options.exportLoad && !options.exportPush && len(options.outputs) == 0 {
5959
options.exportLoad = true
6060
}
6161

@@ -105,5 +105,8 @@ func NewCmdBuild() *cobra.Command {
105105
options.pull = flags.Bool("pull", false, "Always attempt to pull all referenced images")
106106
flags.StringVar(&options.metadataFile, "metadata-file", "", "Write build result metadata to the file")
107107

108+
flags.BoolVar(&options.noLoad, "no-load", false, "Overrides the default --load flag")
109+
flags.MarkHidden("no-load")
110+
108111
return cmd
109112
}

pkg/cmd/build/buildx.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ type buildOptions struct {
8181
exportPush bool
8282
// nolint:structcheck
8383
exportLoad bool
84+
85+
noLoad bool
8486
}
8587

8688
func runBuild(dockerCli command.Cli, in buildOptions) (err error) {

0 commit comments

Comments
 (0)