From c53b0b8a12b5913b26b6e41d58875ccf257dc042 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 4 Oct 2022 12:08:13 +0200 Subject: [PATCH] bake: do not fail printing definition if instance unavailable Signed-off-by: CrazyMax --- commands/bake.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/commands/bake.go b/commands/bake.go index 782541eb..2266545d 100644 --- a/commands/bake.go +++ b/commands/bake.go @@ -86,14 +86,18 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions) (err error } }() - dis, err := getInstanceOrDefault(ctx, dockerCli, in.builder, contextPathHash) - if err != nil { - return err - } - + var dis []build.DriverInfo var files []bake.File var inp *bake.Input + // instance only needed for reading remote bake files or building + if url != "" || !in.printOnly { + dis, err = getInstanceOrDefault(ctx, dockerCli, in.builder, contextPathHash) + if err != nil { + return err + } + } + if url != "" { files, inp, err = bake.ReadRemoteFiles(ctx, dis, url, in.files, printer) } else {