containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
7.62k stars 565 forks source link

nerdctl stats not showing container name #3141

Open venkatasandeeplade opened 5 days ago

venkatasandeeplade commented 5 days ago

Description

We are using nerdctl stats to check the container stas but its not showing containername in the output though its showing container id , CPU% , MEM% etc

Steps to reproduce the issue

  1. Run nerdctl stats command

` user@fips-fresh-install-n1:~$ sudo nerdctl stats --namespace=k8s.io --no-stream | head

CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 0003d96964ba -- 0.00% 18.32MiB / 256MiB 7.16% 66.9MB / 206MB 9.17MB / 0B 27 00c5d0402ef8 -- 0.00% 466.4MiB / 3GiB 15.18% 228MB / 575MB 56.2MB / 0B 22 00e1d959fc02 -- 80298.49% 353.6MiB / 1GiB 34.53% 1.83TB / 328GB 25.9MB / 0B 20 0182f1f8d6a3 -- 12834.53% 77.38MiB / 5GiB 1.51% 1.33TB / 2.64TB 1.95MB / 467kB 9 01c21268b1d3 -- 39037.26% 125.9MiB / 2GiB 6.15% 486MB / 381MB 15.3MB / 0B 7 01d1572eded4 -- 0.00% 180.5MiB / 300MiB 60.18% 25.8MB / 1.97MB 8.19kB / 3.56MB 63 02cf754ea2bd -- 0.00% 239.8MiB / 2GiB 11.71% 64.6MB / 204MB 42.9MB / 4.1kB 6 02fd9869bb0a -- 0.00% 1.621MiB / 8EiB 0.00% 659MB / 357MB 0B / 0B 1 030817dc1480 -- 0.00% 1012KiB / 8EiB 0.00% 1.33TB / 2.64TB 0B / 0B 1`

Describe the results you received and expected

Output should show container name along with other fields

What version of nerdctl are you using?

Container name coming as --

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

Others

Host information

ineedshell@fips-fresh-install-n1:~$ sudo nerdctl info Client: Namespace: default Debug Mode: false

Server: Server Version: 1.6.33 Storage Driver: overlayfs Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 Plugins: Log: fluentd journald json-file syslog Storage: aufs native overlayfs Security Options: apparmor seccomp Profile: default Kernel Version: 5.4.0-1099-fips Operating System: Ubuntu 20.04.6 LTS OSType: linux Architecture: x86_64 CPUs: 12 Total Memory: 503.5GiB Name: fips-fresh-install-n1.corp.net ID: 54a9ebcb-74c3-4954-b920-87741ae88756

venkatasandeeplade commented 5 days ago

@AkihiroSuda Is it known behavior ?

venkatasandeeplade commented 5 days ago

@fahedouch But in docker stats container name can be seen , here -- is seen. What is the reason for that ? Is there any other way to get the container name using nerdctl stats ?

fahedouch commented 5 days ago

@fahedouch But in docker stats container name can be seen , here -- is seen. What is the reason for that ? Is there any other way to get the container name using nerdctl stats ?

Sorry, I checked the code and the name is not passed to the output formatter, it is quick fix, I'll take care