You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
hejianshan
committed
fix: add --timeout flag to container commit
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>
Copy file name to clipboardExpand all lines: docs/command-reference.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -816,6 +816,7 @@ Flags:
816
816
-:whale:`-m, --message`: Commit message
817
817
-:whale:`-c, --change`: Apply Dockerfile instruction to the created image (supported directives: [CMD, ENTRYPOINT])
818
818
-:whale:`-p, --pause`: Pause container during commit (default: true)
819
+
-:nerd_face:`--timeout`: Maximum duration for the commit operation (default: 1h). Set to 0 to use containerd's default lease expiration (24h). Accepts Go duration format (e.g., `2h`, `90m`, `0s`).
819
820
-:nerd_face:`--compression`: Commit compression algorithm (supported values: zstd or gzip) (default: gzip) (zstd is generally better for compression ratio but might not be as widely supported)
820
821
-:nerd_face:`--format`: Format of the committed image (supported values: docker or oci) (default: docker) (docker uses Docker Schema2 media types for compatibility, oci uses OCI image format media types)
821
822
-:nerd_face:`--estargz`: Convert the committed layer to eStargz for lazy pulling
0 commit comments