fix: add --timeout flag to container commit to allow configurable lease timeout - #5108
Open
Turbo-Jiaxxx789 wants to merge 1 commit into
Open
fix: add --timeout flag to container commit to allow configurable lease timeout#5108Turbo-Jiaxxx789 wants to merge 1 commit into
Turbo-Jiaxxx789 wants to merge 1 commit into
Conversation
Turbo-Jiaxxx789
force-pushed
the
fix/commit-timeout-flag
branch
7 times, most recently
from
July 29, 2026 03:42
4a0997b to
2024864
Compare
AkihiroSuda
reviewed
Jul 29, 2026
| cmd.Flags().Bool("zstdchunked", false, "Convert the committed layer to zstd:chunked for lazy pulling") | ||
| cmd.Flags().Int("zstdchunked-compression-level", 3, "zstd:chunked compression level") | ||
| cmd.Flags().Int("zstdchunked-chunk-size", 0, "zstd:chunked chunk size") | ||
| cmd.Flags().Duration("timeout", 1*time.Hour, "Maximum duration for the commit operation (default 1h, 0 for containerd's default 24h)") |
Member
There was a problem hiding this comment.
Author
There was a problem hiding this comment.
The hardcoded 1-hour lease expiration in nerdctl container commit can cause failures for containers with large filesystem deltas (e.g., many packages installed). When the diff.Compare operation exceeds 1 hour, the containerd GC cleans up the expired lease and its ingest data, resulting in 'context deadline exceeded' errors. Changes: - Add Timeout field to ContainerCommitOptions and commit.Opts - Modify Commit() to use configurable lease expiration: * --timeout=0 (or negative): use containerd's default 24h lease * --timeout>0: use the specified duration * --timeout defaults to 1h for backward compatibility - Add --timeout CLI flag (default: 1h) - Add tests for --timeout flag Usage: nerdctl container commit mycontainer myimage:tag # default 1h nerdctl container commit --timeout=4h ... # 4h timeout nerdctl container commit --timeout=0 ... # 24h (containerd default) Signed-off-by: Turbo Jia <turbo@example.com>
Turbo-Jiaxxx789
force-pushed
the
fix/commit-timeout-flag
branch
from
July 29, 2026 10:46
2024864 to
d92459e
Compare
ChengyuZhu6
requested changes
Jul 31, 2026
| var done func(context.Context) error | ||
| if opts.Timeout <= 0 { | ||
| // Use containerd's default lease expiration (24h) | ||
| ctx, done, err = client.WithLease(ctx, leases.WithRandomID()) |
Member
There was a problem hiding this comment.
--timeout=0 creates a lease that never expires. containerd's client.WithLease only applies the 24h default when no opts are passed at all:
https://github.com/containerd/containerd/blob/e3692f42d2220498e6b80a853b512cd21cda0fd4/client/lease.go#L37-L43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…se expiration
The hardcoded 1-hour lease expiration in nerdctl container commit can cause failures for containers with large filesystem deltas (e.g., many packages installed). When the diff.Compare operation exceeds 1 hour, the containerd GC cleans up the expired lease and its ingest data, resulting in 'context deadline exceeded' errors.
Changes:
--timeout<=0→ use containerd's default 24h lease--timeout > 0→ use user spec leaseFixes: #5107