Skip to content

save: add --quiet/-q to suppress progress output#5054

Closed
s3onghyun wants to merge 1 commit into
containerd:mainfrom
s3onghyun:save-quiet-flag
Closed

save: add --quiet/-q to suppress progress output#5054
s3onghyun wants to merge 1 commit into
containerd:mainfrom
s3onghyun:save-quiet-flag

Conversation

@s3onghyun

Copy link
Copy Markdown

Fixes #4958.

nerdctl save always writes a progress bar to stderr, which clutters logs when it is used in scripts and CI. This adds a --quiet/-q flag that suppresses the progress output.

The implementation mirrors the existing --quiet flag on nerdctl load: the flag is threaded into ImageSaveOptions.Quiet, and when set, the transfer progress handler writes to io.Discard instead of os.Stderr. The archive itself is written exactly as before; only the progress output is suppressed.

  • cmd/nerdctl/image/image_save.go: register -q, --quiet and pass it into the options
  • pkg/api/types/image_types.go: add Quiet to ImageSaveOptions
  • pkg/cmd/image/save.go: route progress to io.Discard when quiet
  • docs/command-reference.md: document the flag
  • cmd/nerdctl/image/image_save_test.go: add TestSaveQuiet verifying the archive is still produced correctly with --quiet

Manual check: nerdctl save --help now lists -q, --quiet Suppress the progress output.

@AkihiroSuda

Copy link
Copy Markdown
Member

Please squash the commits

@AkihiroSuda AkihiroSuda added this to the v2.4.0 milestone Jul 9, 2026
@s3onghyun

Copy link
Copy Markdown
Author

Done, squashed into a single commit. Also excluded TestSaveQuiet from the Docker compatibility mode (--quiet is nerdctl-specific), which fixes the earlier CI failure.

Comment thread cmd/nerdctl/image/image_save_test.go Outdated
},
Expected: func(data test.Data, _ test.Helpers) *test.Expected {
return &test.Expected{
ExitCode: 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can use Tigron frameworks exit codes

`nerdctl save` always writes a progress bar to stderr, which clutters
logs when it is used in scripts and CI. Add a `--quiet`/`-q` flag that
routes the transfer progress to io.Discard, mirroring the existing
`--quiet` flag on `nerdctl load`. The archive is still written normally;
only the progress output is suppressed.

--quiet is a nerdctl-specific flag that docker save does not have, so the
new TestSaveQuiet is excluded from the Docker compatibility test mode.

Closes containerd#4958

Signed-off-by: s3onghyun <s3onghyun@users.noreply.github.com>
@s3onghyun

Copy link
Copy Markdown
Author

Thanks @sathiraumesh — updated to use expect.ExitCodeSuccess instead of the literal 0, and amended into the single commit.

@AkihiroSuda

Copy link
Copy Markdown
Member

The PR seems accidentally closed?

@AkihiroSuda AkihiroSuda removed this from the v2.4.0 milestone Jul 9, 2026
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.

nerdctl save --quiet and/or --progress plain

3 participants