From a9ee8fa4d7d610523eb4c95b96dbd21623461c8a Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Tue, 16 Nov 2021 17:51:02 +0900 Subject: [PATCH] stats: add docs Signed-off-by: Akihiro Suda --- README.md | 7 +++++++ cmd/nerdctl/stats.go | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c06c75880bb..2c7b0b4110d 100644 --- a/README.md +++ b/README.md @@ -939,9 +939,16 @@ Flags: ### :whale: nerdctl stats Display a live stream of container(s) resource usage statistics. +NOTE: no support for network I/O on cgroup v2 hosts (yet), see issue [#516](https://github.com/containerd/nerdctl/issues/516) Usage: `nerdctl stats [flags]` +Flags: +- :whale: `-a, --all`: Show all containers (default shows just running) +- :whale: `--format=FORMAT`: Pretty-print images using a Go template, e.g., `{{json .}}` +- :whale: `--no-stream`: Disable streaming stats and only pull the first result +- :whale: `--no-trunc `: Do not truncate output + ### :whale: nerdctl top Display the running processes of a container. diff --git a/cmd/nerdctl/stats.go b/cmd/nerdctl/stats.go index 4d94b608295..a3acdef6e25 100644 --- a/cmd/nerdctl/stats.go +++ b/cmd/nerdctl/stats.go @@ -44,9 +44,12 @@ import ( ) func newStatsCommand() *cobra.Command { + short := "Display a live stream of container(s) resource usage statistics." + long := short + "\nNOTE: no support for network I/O on cgroup v2 hosts (yet), see https://github.com/containerd/nerdctl/issues/516" var statsCommand = &cobra.Command{ Use: "stats", - Short: "Display a live stream of container(s) resource usage statistics.", + Short: short, + Long: long, RunE: statsAction, ValidArgsFunction: statsShellComplete, SilenceUsage: true, @@ -60,7 +63,7 @@ func newStatsCommand() *cobra.Command { func addStatsFlags(cmd *cobra.Command) { cmd.Flags().BoolP("all", "a", false, "Show all containers (default shows just running)") - cmd.Flags().String("format", "", "Pretty-print images using a Go template") + cmd.Flags().String("format", "", "Pretty-print images using a Go template, e.g, '{{json .}}'") cmd.Flags().Bool("no-stream", false, "Disable streaming stats and only pull the first result") cmd.Flags().Bool("no-trunc", false, "Do not truncate output") }