singe / ebpf-docker-for-mac Goto Github PK
View Code? Open in Web Editor NEWHow to run eBPF on Docker for mac
How to run eBPF on Docker for mac
I run the python program in the image but it is failing. Kernel header is not found :
root@46a12dcd4efd:~# python3 hello_world.py
modprobe: FATAL: Module kheaders not found in directory /lib/modules/5.10.76-linuxkit
Unable to find kernel headers. Try rebuilding kernel with CONFIG_IKHEADERS=m (module)
chdir(/lib/modules/5.10.76-linuxkit/build): No such file or directory
Traceback (most recent call last):
File "hello_world.py", line 14, in <module>
b = BPF(text=prog)
File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 347, in __init__
raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>
I ran
python3 hello_world.py
I get error:
modprobe: FATAL: Module kheaders not found in directory /lib/modules/4.19.121-linuxkit
Unable to find kernel headers. Try rebuilding kernel with CONFIG_IKHEADERS=m (module)
chdir(/lib/modules/4.19.121-linuxkit/build): No such file or directory
Traceback (most recent call last):
File "hello_world.py", line 14, in <module>
b = BPF(text=prog)
File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 347, in __init__
raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>
hi team,
when I run ebpf programs on this image, there is an err:
include/linux/kconfig.h:7:10: fatal error: 'generated/autoconf.h' file not found
I thought the cause of that is short of linux-headers file, and we could solve it by re-complier it.
Here is my solution:
download linux-files, then write some parameters to the config file and compiler it.
root@3d19bc07c1ed:~# python3 hello_world.py
modprobe: FATAL: Module kheaders not found in directory /lib/modules/5.10.76-linuxkit
Unable to find kernel headers. Try rebuilding kernel with CONFIG_IKHEADERS=m (module)
chdir(/lib/modules/5.10.76-linuxkit/build): No such file or directory
Traceback (most recent call last):
File "hello_world.py", line 14, in <module>
b = BPF(text=prog)
File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 347, in __init__
raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.