GitHub - singe/ebpf-docker-for-mac: How to run eBPF on Docker for mac
source link: https://github.com/singe/ebpf-docker-for-mac?spm=a2c6h.12873639.article-detail.4.3e805798KLBkfr
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
eBPF for Docker Desktop on macOS
eBPF and its compiler bcc need access to some parts of the kernel and its headers to work. This image shows how you can do that with Docker Desktop for mac's linuxkit host VM.
Build the image
Done quite simply with:
docker build -t ebpf-for-mac .
Run the image
It needs to run as privileged, and depending on what you want to do, having access to the host's PID namespace is pretty useful too.
docker run -it --rm \
--privileged \
-v /lib/modules:/lib/modules:ro \
-v /etc/localtime:/etc/localtime:ro \
--pid=host \
ebpf-for-mac
Note: /lib/modules probably doesn't exist on your mac host, so Docker will map the volume in from the linuxkit host VM.
Maintenance
Docker published their for-desktop kernel's on Docker hub you may need to update the Dockerfile for the latest kernel that matches your linuxkit host VM.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK