【问题标题】:is it possible to run linux perf tool inside docker container是否可以在 docker 容器中运行 linux perf 工具
【发布时间】:2018-03-22 07:34:32
【问题描述】:

我尝试从容器中给出以下命令并发现以下问题,可能是因为“-moby”内核版本。我们不能在 linux 内核版本中获得一个没有“-moby”字样的 docker 镜像吗?

我尝试在具有 ubuntu 的 VM 上安装 linux perf 工具,它工作正常。

#docker run -t -i ubuntu:14.04 /bin/bash

root@214daea94f4f:/# perf

WARNING: perf not found for kernel 4.9.41

You may need to install the following packages for this specific kernel:

linux-tools-4.9.41-moby
linux-cloud-tools-4.9.41-moby

You may also want to install one of the following packages to keep up to date:

linux-tools-moby-lts-<series>
linux-cloud-tools-moby-lts-<series>

【问题讨论】:

  • 您是否有适用于主机的 perf 版本?可以在容器上运行它。
  • 你需要在 Docker VM 上运行 perf 而我不认为 alpine has a package for it
  • @MarkPlotnick,我有性能在主机上工作,但我不想将性能二进制文件复制到容器并运行它。我的目标是让 docker 镜像可以在任何机器上构建 perf。
  • Rupesh,检查你的 linux 的任何 linux-tools-* 包,安装它,获取包的文件列表并使用真正的 perf 二进制文件而不是这个 不正确的 debian 包装器脚本 /usr/bin/perf 搜索uname -r perf(并且错误的“可能需要...”消息生成器)。任何perf 二进制文件 (/usr/lib/linux-tools/*/perf) 都可以与任何内核版本一起使用(perf_events API 双向兼容,旧工具的功能将受到限制)。要构建 perf 包,您可以构建 Linux 内核或以 debian 方式进行(apt-get source linux-image....,wiki.debian.org/BuildingTutorial

标签: linux docker containers perf moby


【解决方案1】:

只是做

apt-get install linux-tools-generic

并建立到 /usr/bin/perf 的符号链接。 (就我而言):

ln -s /usr/lib/linux-tools/3.13.0-141-generic/perf /usr/bin/perf

它对我有用!

【讨论】:

【解决方案2】:

我在 debian buster-slim 中使用过:

apt-get install linux-perf 

见:https://packages.debian.org/buster/linux-perf

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-31
    • 2016-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-21
    • 1970-01-01
    相关资源
    最近更新 更多