Creating a Container Image with an AlmaLinux OS Upgrade
This procedure describes how to create a Docker container image from controlm/agent that includes an upgrade of the AlmaLinux OS stream (where the default is AlmaLinux 10.2) without rebuilding the full upstream image.
Such an image enables you to upgrade to a newer version of AlmaLinux immediately, without having to wait for a new version of Control-M for Kubernetes.
BMC-provided images are based on AlmaLinux Minimal, which includes a microdnf package manager.
Use this procedure only if you want to upgrade to a higher minor version of AlmaLinux. For example, from version 10.2 to 10.3, but not from version 10.2 to 11.0.
Before You Begin
Ensure that you meet the following prerequisites:
-
A Docker installed and running
-
Access to pull controlm/agent from the Docker Hub
-
Network access to AlmaLinux repositories during the image build
Begin
-
Create a Dockerfile named Dockerfile.os-upgrade with the following content:
CopyARG SOURCE_IMAGE=controlm/agent:9.22.110-k8s
FROM ${SOURCE_IMAGE}
ARG ALMALINUX_RELEASEVER=10.2
USER root
# Upgrade to target AlmaLinux stream
RUN microdnf -y --releasever=${ALMALINUX_RELEASEVER} distro-sync \
&& microdnf -y --releasever=${ALMALINUX_RELEASEVER} update \
&& microdnf clean all
# Recreate build metadata so it reflects the upgraded OS
RUN rm -rf /etc/image-build-info \
&& mkdir -p /etc/image-build-info \
&& cat /etc/os-release > /etc/image-build-info/os-release.txt \
&& cat /etc/redhat-release > /etc/image-build-info/redhat-release.txt \
&& if command -v rpm >/dev/null 2>&1; then rpm -q almalinux-release >
/etc/image-build-info/almalinux-release-rpm.txt; fi \
&& microdnf repoquery --installed --info > /etc/image-build-info/installed-packages.txt \
&& date -u > /etc/image-build-info/build-date-utc.txt \
&& uname -r > /etc/image-build-info/kernel.txt \
&& echo "===== /etc/image-build-info =====" \
&& for f in /etc/image-build-info/*; do echo "--- ${f} ---"; cat "${f}"; done
USER controlmTo create a custom image on top of an MFT base image, use 9.22.110-k8s-mft instead of 9.22.110-k8s.
-
Build an image based on the Dockerfile that you created by running one of the following commands:
-
(Default target OS stream)
docker build -f <Dockerfile name> -t <image name> .
-
(With target OS stream override)
docker build -f <Dockerfile name> --build-arg ALMALINUX_RELEASEVER=<version> -t <image name> .
The image name includes the name of the repository where you want to upload the created image.
-
For a default target OS stream:
docker build -f Dockerfile.os-upgrade -t myrepo/controlm-agent:alma10.2
-
With a target OS stream override:
docker build -f Dockerfile.os-upgrade \
--build-arg ALMALINUX_RELEASEVER=10.2 \
-t myrepo/controlm-agent:alma10.2 .
-
-
Verify the AlmaLinux OS version by doing the following:
-
Run a command such as the following:
docker run --rm --entrypoint /bin/sh myrepo/controlm-agent:alma10.2 \
-c "cat /etc/os-release; echo; cat /etc/redhat-release; echo; rpm -q almalinux-release"
-
Check the command output for the following elements:
-
VERSION_ID="10.2" (or the value of ALMALINUX_RELEASEVER)
-
AlmaLinux release 10.2
-
almalinux-release-10.2-*.el9.*
-
-
-
Push the image to your private repository by running the following command:
docker push <image name>
The image name includes the name of the repository where you want to upload the image.
docker push myrepo/controlm-agent:alma10.2
-
After the upgrade, recreate /etc/image-build-info to ensure that no old metadata remains from the source image.
-
Prefer fixed source image tags (or digests) for reproducible builds.
-
If --releasever fails, verify that your enabled repositories expose the target stream.
