-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support zstd (non-chunked) conversion #2530
Conversation
pkg/imgutil/converter/zstd.go
Outdated
} | ||
|
||
pr, pw := io.Pipe() | ||
enc, err := zstd.NewWriter(pw, zstd.WithEncoderLevel(zstd.EncoderLevel(options.ZstdCompressionLevel))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use EncoderLevelFromZstd
? https://pkg.go.dev/github.com/klauspost/compress/zstd#EncoderLevelFromZstd
// #region zstd flags | ||
imageConvertCommand.Flags().Bool("zstd", false, "Convert legacy tar(.gz) layers to zstd. Should be used in conjunction with '--oci'") | ||
imageConvertCommand.Flags().Int("zstd-compression-level", 3, "zstd compression level") | ||
// #endregion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add docs to /docs/command-reference.md
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. will do
docs/command-reference.md
Outdated
@@ -878,6 +878,8 @@ Flags: | |||
- `--estargz-min-chunk-size=<SIZE>` : The minimal number of bytes of data must be written in one gzip stream (requires stargz-snapshotter >= v0.13.0). Useful for creating a smaller eStargz image (refer to [`./stargz.md`](./stargz.md) for details). | |||
- `--estargz-external-toc` : Separate TOC JSON into another image (called \"TOC image\"). The name of TOC image is the original + \"-esgztoc\" suffix. Both eStargz and the TOC image should be pushed to the same registry. (requires stargz-snapshotter >= v0.13.0) Useful for creating a smaller eStargz image (refer to [`./stargz.md`](./stargz.md) for details). :warning: This flag is experimental and subject to change. | |||
- `--estargz-keep-diff-id`: Convert to esgz without changing diffID (cannot be used in conjunction with '--estargz-record-in'. must be specified with '--estargz-external-toc') | |||
- `--zstd` : Use zstd compression instead of gzip (a.k.a zstd). Should be used in conjunction with '--oci' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(a.k.a zstd)
is unneeded maybe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. updated
Signed-off-by: Henry Wang <henwang@amazon.com>
This PR adds non-chunked zstd image conversion to
nerdctl
.nerdctl
today already supports converting images tozstdchunked
format for lazy-loading. Traditional non-chunkedzstd
format is usually smaller than the chunked equivalent, and faster to convert. This is desirable for the non lazy-loading scenarios.The following is the image size comparison between gzip, zstd and ztdchunked formats. Both
zstd
andzstdchunked
used the default level 3 compression level.