Camilo Díaz Repka
Camilo Díaz Repka

Reputation: 4815

How can I run perf inside LinuxKit (Docker for Mac)?

I have Docker for Mac with LinuxKit kernel version 4.9.125-linuxkit.

perf is not available on the host. I tried to install it on one of my Ubuntu containers but I'm unable to get the versioned linux-tools package for the 4.9.125 kernel. So when I try to run perf, I just get

WARNING: perf not found for kernel 4.9.125

Is there a way to run perf on my LinuxKit/Hyperkit host, and if so, how?

Upvotes: 3

Views: 1182

Answers (1)

Diego
Diego

Reputation: 444

Create the image

docker build -t myubuntu - <<EOF 
FROM ubuntu
RUN apt-get update && apt-get install -y linux-tools-common linux-tools-generic gcc wget vim
RUN ln -fs /usr/lib/linux-tools/*/perf /usr/bin/perf
EOF

And then run: docker run --cap-add SYS_ADMIN -it myubuntu /bin/bash

Upvotes: 5

Related Questions