Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux headers for ubuntu docker image 18.04

I am trying to install linux header for my ubuntu 18.04 docker image (ubuntu:18.04). Usually I will do sudo apt-get install linux-headers-$(uname -r) in my VM to get the current linux header packages.

But the docker image return the following when I run uname -r

root@0c4e24cca819:/# uname -r
4.19.76-linuxkit

Just wonder which linux header image I should use for ubuntu:18.04 docker image?

like image 783
Kintarō Avatar asked Nov 23 '25 22:11

Kintarō


1 Answers

Docker by definition runs your current kernel. If you are on a machine whose kernel has not been packaged for Ubuntu then there is no package you can install to get its headers.

Looks like you're on a Mac, so definitely that is the case here. Perhaps you could ask the Docker for Mac maintainers to provide headers for some popular platforms for their kernel, but I suspect they don't want to take on that responsibility.

As a workaround, maybe run Docker inside Linux on e.g. Virtualbox.

like image 144
tripleee Avatar answered Nov 25 '25 16:11

tripleee