Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install kernel headers for docker desktop, for BCC
#!/bin/bash
set -x
set -e
KERNEL_VERSION="${KERNEL_VERSION:-$(uname -r)}"
kernel_version="$(echo "${KERNEL_VERSION}" | awk -vFS=- '{ print $1 }')"
major_version="$(echo "${KERNEL_VERSION}" | awk -vFS=. '{ print $1 }')"
apt-get install -y build-essential bc curl flex bison libelf-dev
mkdir -p /usr/src/linux
curl -sL "https://www.kernel.org/pub/linux/kernel/v${major_version}.x/linux-$kernel_version.tar.gz" | tar --strip-components=1 -xzf - -C /usr/src/linux
cd /usr/src/linux
zcat /proc/config.gz > .config
make ARCH=x86 oldconfig
make ARCH=x86 prepare
mkdir -p /lib/modules/$(uname -r)
ln -sf /usr/src/linux /lib/modules/$(uname -r)/source
ln -sf /usr/src/linux /lib/modules/$(uname -r)/build
@dalehamel

This comment has been minimized.

Copy link
Owner Author

@dalehamel dalehamel commented Feb 6, 2020

tested against latest docker stable (2.2.0) with kernel 4.19

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