Reputation: 41
I'm fairly new to Docker, and I'm trying to use perf to check performance on some stuff. Perf doesn't come with the images I'm using, so I went to install it. I used
apt-get update
apt-get install perf
which didn't work because perf is part of another package. I then tried
apt-get install -y linux-tools-common linux-tools-generic linux-tools-`uname -r`
which resulted in
E: Unable to locate package linux-tools-common
E: Unable to locate package linux-tools-generic
E: Unable to locate package linux-tools-3.10.0-862.3.3.el7.x86_64
E: Couldn't find any package by glob 'linux-tools-3.10.0-862.3.3.el7.x86_64'
E: Couldn't find any package by regex 'linux-tools-3.10.0-862.3.3.el7.x86_64'
Any recommendations as to what I should try?
Upvotes: 4
Views: 2834
Reputation: 1897
I assume that you have a fairly recent Linux in your container and an old one on the host.
Note that perf has to be the exact same version as your Linux kernel. And that with containerization the kernel of the host system is used.
When you install the generic perf package in the container the package manager retrieves the version of the (host) kernel and tries to install the perf package with the very same version. Due to the newer version of the Linux distribution in the container, the necessary older perf package is not part of its package repository anymore leading to the error message you are seeing.
There are multiple solutions to this:
a) update the host Linux kernel to supported by the containers Linux distribution's release,
b) downgrade the containers Linux distribution, or
c) make the necessary perf package available in the container. This is probably tricky and you might screw up the container's package manager. But it's just a container ;). You can figure out the necessary version with uname -a
.
Upvotes: 1