Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
install kernel headers for docker desktop, for BCC
set -x
set -e
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 "${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
Copy link

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