Trouble getting basic example working via docker macOS
Integralist opened this issue · 1 comments
Integralist commented
Hello,
Here is Dockerfile that installs pyflame, but when I attempt to run the container I get an error (detailed below).
Any help/guidance appreciated.
FROM python:3.6.3
WORKDIR /pyflame
RUN apt-get update -y
RUN apt-get install -y git autoconf automake autotools-dev g++ pkg-config python-dev python3-dev libtool make
RUN git clone https://github.com/uber/pyflame.git && \
cd pyflame && ./autogen.sh && ./configure && make
COPY 7_pyflame.py /app/app.py
WORKDIR /app
CMD ["/pyflame/pyflame/src/pyflame", "-t", "python", "app.py"]
I build the image docker build -t pyflame .
and run it docker run pyflame
.
But I then get the following error...
terminate called after throwing an instance of 'pyflame::PtraceException'
what(): Failed to PTRACE_TRACEME
terminate called after throwing an instance of 'pyflame::PtraceException'
what(): Failed to PTRACE_SETOPTIONS
Below is the application code:
def foo():
return 1 + 1
def get_number():
foo()
for i in range(10000000):
yield i
def expensive_function():
for n in get_number():
r = n ^ n ^ n
return f"some result! {r}"
result = expensive_function()
print(result)
Integralist commented
Looks like I needed --privileged
flag on docker run
command.