docker容器中没有top命令

Ali*_*igy 2 linux top docker

mcr.microsoft.com/dotnet/aspnet:5.0我尝试使用需要具有 top 命令的图像在 docker 容器中部署应用程序

当我尝试运行 top 命令时,显示以下结果:

bash: top: command not found
Run Code Online (Sandbox Code Playgroud)

如何安装 top 命令?

Ali*_*igy 6

我尝试在 docker 容器内运行以下命令来搜索顶级命令

$ apt-file search --regexp '/top$'
Run Code Online (Sandbox Code Playgroud)

结果:

broctl: /usr/share/broctl/scripts/helpers/top
crossfire-maps: /usr/share/games/crossfire/maps/santo_dominion/magara/well/top
crossfire-maps-small: /usr/share/games/crossfire/maps/santo_dominion/magara/well/top
liece: /usr/share/emacs/site-lisp/liece/styles/top
lxpanel: /etc/xdg/lxpanel/two_panels/panels/top
open-infrastructure-container-tools: /usr/lib/open-infrastructure/container/top
procps: /usr/bin/top
quilt: /usr/share/quilt/top
Run Code Online (Sandbox Code Playgroud)

所以我尝试在 docker 容器内使用以下命令安装 procps

$ apt install procps
Run Code Online (Sandbox Code Playgroud)