Skip to content

Instantly share code, notes, and snippets.

@marselester
Created April 6, 2021 17:29
Show Gist options
  • Save marselester/ac8e4262742c90539c8c53f37d9a6965 to your computer and use it in GitHub Desktop.
Save marselester/ac8e4262742c90539c8c53f37d9a6965 to your computer and use it in GitHub Desktop.
BPF tools without LLVM, Clang, and kernel header dependencies at runtime.
FROM ubuntu:groovy as build
RUN apt-get update && \
apt-get install -y git flex bison llvm cmake clang libclang-dev libelf-dev libcap-dev python3-setuptools && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /opt/
RUN git clone https://github.com/iovisor/bcc.git && \
mkdir ./bcc/build/ && \
cd ./bcc/build/ && \
cmake -DPYTHON_CMD=python3 .. && \
make && \
cd ../libbpf-tools && \
make
FROM ubuntu:groovy
RUN apt-get update && \
apt-get install -y libelf-dev && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /opt/
COPY --from=build \
/opt/bcc/libbpf-tools/ext4dist \
/opt/bcc/libbpf-tools/runqlen \
/opt/bcc/libbpf-tools/cpudist \
/opt/bcc/libbpf-tools/softirqs \
/opt/bcc/libbpf-tools/filelife \
/opt/bcc/libbpf-tools/readahead \
/opt/bcc/libbpf-tools/funclatency \
/opt/bcc/libbpf-tools/biolatency \
/opt/bcc/libbpf-tools/biosnoop \
/opt/bcc/libbpf-tools/llcstat \
/opt/bcc/libbpf-tools/biopattern \
/opt/bcc/libbpf-tools/runqslower \
/opt/bcc/libbpf-tools/xfsslower \
/opt/bcc/libbpf-tools/numamove \
/opt/bcc/libbpf-tools/hardirqs \
/opt/bcc/libbpf-tools/bitesize \
/opt/bcc/libbpf-tools/opensnoop \
/opt/bcc/libbpf-tools/runqlat \
/opt/bcc/libbpf-tools/tcpconnect \
/opt/bcc/libbpf-tools/cpufreq \
/opt/bcc/libbpf-tools/drsnoop \
/opt/bcc/libbpf-tools/vfsstat \
/opt/bcc/libbpf-tools/biostacks \
/opt/bcc/libbpf-tools/cachestat \
/opt/bcc/libbpf-tools/tcpconnlat \
/opt/bcc/libbpf-tools/syscount \
/opt/bcc/libbpf-tools/execsnoop \
./
@marselester
Copy link
Author

marselester commented Apr 6, 2021

BPF tools without LLVM, Clang, and kernel header dependencies at runtime, see #3224.

$ docker build -t marselester/libbpf-tools:latest .
$ docker run --rm -it --privileged marselester/libbpf-tools:latest bash
% ./execsnoop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment