From 2c1c673a3d6db492104564634c8e4b1b4eaa62d5 Mon Sep 17 00:00:00 2001 From: Seth Hollandsworth Date: Wed, 6 Sep 2023 10:22:36 -0400 Subject: [PATCH] defaulting to unbuffered reader for dmverity hashing Co-authored-by: ksayid Signed-off-by: Seth Hollandsworth --- cmd/dmverity-vhd/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/dmverity-vhd/main.go b/cmd/dmverity-vhd/main.go index c2f88a6faa..1dbe728c16 100644 --- a/cmd/dmverity-vhd/main.go +++ b/cmd/dmverity-vhd/main.go @@ -103,7 +103,13 @@ func fetchImageLayers(ctx *cli.Context) (layers []v1.Layer, err error) { // if only an image name is provided and not a tag, the default is "latest" img, err = tarball.ImageFromPath(tarballPath, &imageNameAndTag) } else if dockerDaemon { - img, err = daemon.Image(ref) + // use the unbuffered opener, the tradeoff being the image will stream as needed + // so it is slower but much more memory efficient + var opts []daemon.Option + opt := daemon.WithUnbufferedOpener() + opts = append(opts, opt) + + img, err = daemon.Image(ref, opts...) } else { var remoteOpts []remote.Option if ctx.IsSet(usernameFlag) && ctx.IsSet(passwordFlag) {