Use perf inside a docker container without --privileged
I am trying to use the perf tool inside a Docker container to record a given command. kernel.perf_event_paranoid is set to 1, but the container behaves just as if it where 2, when I don't put the --privileged flag. I could use --privileged, but the code I am running perf on is not trusted and if I am OK with taking a slight security risk by allowing perf tool, giving privileged rights on the container seems a different level of risk. Is there any other way to use perf inside the container? ~$ docker version Client: Version: 17.03.1-ce API version: 1.27 Go version: go1.7.5 Git commit: 7392c3b