There are two ways to include the service file. It can be hosted somewhere and then referenced via a cloud-config file.
#cloud-config
rancher:
services_include:
https://raw.githubusercontent.com/rancher/os-services/embedded-headers/k/kernel-headers.yml: true
The service can also be directly embedded in a cloud-config file.
#cloud-config
rancher:
services:
kernel-headers:
image: rancher/os-headers:v0.7.1-embedded
labels:
io.rancher.os.detach: "false"
io.rancher.os.after: network
volumes:
- /usr/src:/usr/src
- /lib/modules:/lib/modules
- /usr/bin/ros:/usr/bin/ros
The image for this service is available in rancher/os-headers:v0.7.1-embedded
. It can also be built manually with the following two files.
FROM rancher/os-base:v0.7.1
ENV KERNEL_HEADERS_URL https://github.com/rancher/os-kernel/releases/download/Ubuntu-4.4.0-47.68-rancher1/build.tar.gz
RUN wget -O /build.tar.gz $KERNEL_HEADERS_URL
COPY headers.sh /
CMD ["/headers.sh"]
#!/bin/bash
set -e
DIR=$(readlink /lib/modules/$(uname -r)/build)
STAMP=${DIR}/.done
VER=$(basename $DIR)
if [ -e $STAMP ]; then
echo Headers already installed in $DIR
exit 0
fi
mkdir -p $DIR
cat /build.tar.gz | gzip -dc | tar xf - -C $DIR
touch $STAMP
echo Headers installed at $DIR