14.3. 在 Containerfile 中注入内核参数
将内核参数注入 Red Hat Enterprise Linux Containerfile 中,以便在镜像构建过程中配置引导参数。嵌入这些设置会统一将特定的内核选项应用到容器镜像中任何调配的系统,从而消除了部署后配置。
先决条件
- 您创建了一个容器镜像。
流程
注入内核参数:
FROM registry.redhat.io/rhel10/rhel-bootc:latest RUN mkdir -p /usr/lib/bootc/kargs.d RUN cat <<EOF >> /usr/lib/bootc/kargs.d/console.toml kargs = ["console=ttyS0,115200n8"] match-architectures = ["x86_64"] EOF RUN cat <<EOF >> /usr/lib/bootc/kargs.d/01-mitigations.toml kargs = ["mitigations=on", "systemd.unified_cgroup_hierarchy=0"] match-architectures = ["x86_64", "aarch64"] EOF