With the release of Fedora 41, dnf can be used on Container builds to install packages in image mode build as most of us are accustomed to in package mode Fedora. However installing, upgrading or downgrading kernels could only still be managed with rpm-ostree.
With rpm-ostree 2025.2 this changes! This release of rpm-ostree provides kernel-install integration. A image mode container with rpm-ostree 2025.2 and a couple of configuration files will allow admins and power users to use DNF to manage their Kernel.
I also have built a custom image quay.io/jmarrero_rh/fedora-bootc:kernel-install-41 that includes the changes that you can use to test while the official Fedora-bootc:41 is updated.
Once the fedora-bootc 41 image has been updated I will remove my custom one.
An example of a Containerfile using this feature is a simple as:
FROM quay.io/jmarrero_rh/fedora-bootc:kernel-install-41
RUN sudo dnf -y upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-2d3a101e1b
I tested quay.io/jmarrero_rh/fedora-bootc:kernel-install-41 with the kernel-6.12.11-200.fc41. Then I noticed that the installed version was rpm-ostree-2025.1-1.fc41.x86_64. I created an image from quay.io/jmarrero_rh/fedora-bootc:kernel-install-41 with rpm-ostree-2025.2-1.fc41.x86_64 and tested the kernel-6.12.11-200.fc41 again. At least on my side, both versions rpm-ostree-2025.1-1.fc41.x86_64 and rpm-ostree-2025.2-1.fc41.x86_64 were able to upgrade the kernel.
For example, starting from a CentOS Stream 9 image:
FROM quay.io/centos-bootc/centos-bootc:stream9
RUN <<EORUN
set -xeuo pipefail
arch=$(arch)
dnf -y upgrade https://composes.stream.centos.org/development/CentOS-Stream-9-20250203.d.0/compose/AppStream/${arch}/os/Packages/rpm-ostree-{,libs-}2025.4-1.el9.${arch}.rpm
if ! grep -q layout=ostree /usr/lib/kernel/install.conf; then
echo layout=ostree >> /usr/lib/kernel/install.conf
fi
# Replace the kernel here
dnf -y upgrade kernel
ls -ald /usr/lib/modules/*
dnf clean all
bootc container lint
EORUN
In addition to CentOS Stream 9, I also tested the following Containerfile for Fedora 41.
FROM quay.io/fedora/fedora-bootc:41
RUN <<EORUN
set -xeuo pipefail
# rpm-ostree-2025.4-2.fc41
dnf -y upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-4c48f77d75
if ! grep -q layout=ostree /usr/lib/kernel/install.conf; then
echo layout=ostree >> /usr/lib/kernel/install.conf
fi
# Replace the kernel here
# kernel-6.12.12-200.fc41
dnf -y upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-d00af34217
ls -ald /usr/lib/modules/*
dnf clean all
bootc container lint
EORUN