Skip to content

Instantly share code, notes, and snippets.

@latonis
Forked from andreybleme/Dockerfile
Created October 18, 2022 03:14
Show Gist options
  • Save latonis/6410cdf4f6ee5580e1e445d112eb3a14 to your computer and use it in GitHub Desktop.
Save latonis/6410cdf4f6ee5580e1e445d112eb3a14 to your computer and use it in GitHub Desktop.
Minimal Dockerfile container for running BPF programs using libbpf
FROM ubuntu:latest
RUN apt-get update && \
apt-get install -y build-essential git cmake \
zlib1g-dev libevent-dev \
libelf-dev llvm \
clang libc6-dev-i386
RUN mkdir /src && \
git init
WORKDIR /src
# Link asm/byteorder.h into eBPF
RUN ln -s /usr/include/x86_64-linux-gnu/asm/ /usr/include/asm
# Build libbpf as a static lib
RUN git clone https://github.com/libbpf/libbpf-bootstrap.git && \
cd libbpf-bootstrap && \
git submodule update --init --recursive
RUN cd libbpf-bootstrap/libbpf/src && \
make BUILD_STATIC_ONLY=y && \
make install BUILD_STATIC_ONLY=y LIBDIR=/usr/lib/x86_64-linux-gnu/
# Clones the linux kernel repo and use the latest linux kernel source BPF headers
RUN git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git && \
cp linux/include/uapi/linux/bpf* /usr/include/linux/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment