运行top命令得到容器信息

623 阅读1分钟

主题

Running the original top command in a container will not get information of the container

容器中的top。

在容器中运行原始的top 命令不会得到容器的信息,许多指标,如正常运行时间、用户、平均负载、任务、cpu、内存,实际上是关于主机的。
topictop in container)将从容器中检索这些指标,而不是显示容器的状态,而不是主机。

下面显示了一个有2个cpu和2个Gi的容器在使用--cpu 2 时的运行状态。

Running the original top command in a container will not get information of the container

如何使用

从GitHub的发布页面下载topic 到你要检查的容器中,并在二进制文件中添加x 属性,然后运行二进制文件!

如何构建

在linux和amd64上运行make buildtopic 只支持linux。如果你想在其他架构上运行,GOARCH 是需要设置的。

GitHub

github.com/silenceshel…