Skip to content

[Feat] Add commit compression type support #4061

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lengrongfu
Copy link

@lengrongfu lengrongfu commented Mar 31, 2025

Fix #4060

Use zstd compression can shorten commit time. current containerd v2 having support zstd commit type, but containerd v1 version don't support.

Test case:

  1. create nginx pod, write a 5G file.
#!/bin/sh
for ((i=1; i<=5; i++))
do
  dd if=/dev/urandom of=$i".txt" bs=500M count=2
done
  1. use zstd compression to commit container only need 29s time.
$ nerdctl -n k8s.io commit ca45e0595384b14ee1fbef6f0a38efb2a2725471cb8fc143d9720a068d8b6cb1 easzlab.io.local:5000/demo/nginx:v2 --pause=true --compression=zstd

image

to view blob type.

$ nerdctl -n k8s.io image inspect --mode=native easzlab.io.local:5000/demo/nginx:v2

image

  1. use gzip compression to commit container need 2m5s time.
$ nerdctl -n k8s.io commit ca45e0595384b14ee1fbef6f0a38efb2a2725471cb8fc143d9720a068d8b6cb1 easzlab.io.local:5000/demo/nginx:v3 --pause=true

image

@apostasie
Copy link
Contributor

CI is failing right now - bustage will be fixed by #4058

@lengrongfu
Copy link
Author

@yankay @AkihiroSuda please take a look, thanks.

@AkihiroSuda
Copy link
Member

CI is failing

@@ -98,3 +107,10 @@ func commitShellComplete(cmd *cobra.Command, args []string, toComplete string) (
}
return nil, cobra.ShellCompDirectiveNoFileComp
}

func verifyOption(op types.ContainerCommitOptions) (bool, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not deserve to be a separate function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

container commit use compression type,eg zstd, gzip
4 participants