diff --git a/pkg/imgutil/load/load.go b/pkg/imgutil/load/load.go index 5e80096d5db..c8b4c629a56 100644 --- a/pkg/imgutil/load/load.go +++ b/pkg/imgutil/load/load.go @@ -86,7 +86,6 @@ func FromArchive(ctx context.Context, client *containerd.Client, options types.I var loadedImages []images.Image pf, done := transferutil.ProgressHandler(ctx, options.Stdout) - defer done() err = client.Transfer(ctx, tarchive.NewImageImportStream(options.Stdin, ""), @@ -96,9 +95,6 @@ func FromArchive(ctx context.Context, client *containerd.Client, options types.I if img, err := imageService.Get(ctx, p.Name); err == nil { if !beforeSet[img.Name] { loadedImages = append(loadedImages, img) - if !options.Quiet { - fmt.Fprintf(options.Stdout, "Loaded image: %s\n", img.Name) - } } } } @@ -106,6 +102,14 @@ func FromArchive(ctx context.Context, client *containerd.Client, options types.I }), ) + done() + + if !options.Quiet { + for _, img := range loadedImages { + fmt.Fprintf(options.Stdout, "Loaded image: %s\n", img.Name) + } + } + return loadedImages, err }