Embed MicroShift containers for offline deployments
You can use image builder to create RHEL for Edge images with embedded MicroShift container images. To embed container images, you must add the image references to your image builder blueprint file.
|
|
For offline or disconnected configurations, embed all container image dependencies as part of the system image. When container images are downloaded without being embedded into the system image, CRI-O wipes them off during unclean shutdowns, such as when a power loss occurs. In this case, you can only restore those container images when the system is online. |
-
You have root-user access to your build host.
-
Your build host meets the image builder system requirements.
-
You installed and set up image builder and the
composer-clitool. -
You created a RHEL for Edge image blueprint.
-
You installed jq.
-
Get the exact list of container image references used by the MicroShift version you are deploying. You can either install the
microshift-release-infoRPM package by following step 2 or download and unpack the RPM by following step 3. -
To install the
microshift-release-infoRPM package:-
Install the
microshift-release-infoRPM package by running the following command:$ sudo dnf install -y microshift-release-info-<release_version>Replace
<release_version>with the numerical value of the release you are deploying, using the entire version number, such as4.20.1. -
List the contents of the
/usr/share/microshift/releasedirectory to verify the presence of the release information files by running the following command:$ sudo ls /usr/share/microshift/releaseExample outputrelease-x86_64.json release-aarch64.jsonIf you installed the
microshift-release-infoRPM, proceed to step 4.
-
-
If you did not complete step 2, download and unpack the
microshift-release-infoRPM without installing it:-
Download the RPM package by running the following command:
$ sudo dnf download microshift-release-info-<release_version>Replace
<release_version>with the numerical value of the release you are deploying, using the entire version number, such as4.20.1.Example RPM outputmicroshift-release-info-4.20.1.-202512101230.p0.g7dc6a00.assembly.4.20.1.el9.noarch.rpm -
Unpack the RPM package without installing it by running the following command:
$ rpm2cpio <my_microshift_release_info> | cpio -idmv ./usr/share/microshift/release/release-aarch64.json ./usr/share/microshift/release/release-x86_64.jsonReplace
<my_microshift_release_info>with the name of the RPM package from the previous step.
-
-
Define the location of your JSON file, which contains the container reference information, by running the following command:
$ RELEASE_FILE=</path/to/your/release-$(uname -m).json>Replace
</path/to/your/release-$(uname -m).json>with the full path to your JSON file. Be sure to use the file needed for your architecture. -
Define the location of your TOML file, which contains instructions for building the image, by running the following command:
$ BLUEPRINT_FILE=</path/to/your/blueprint.toml>Replace
</path/to/your/blueprint.toml>with the full path to your TOML file. -
Generate and then embed the container image references in your blueprint TOML file by running the following command:
$ jq -r '.images | .[] | ("[[containers]]\nsource = \"" + . + "\"\n")' "${RELEASE_FILE}" >> "${BLUEPRINT_FILE}"Example resulting TOML fragment showing container references[[containers]] source = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:82cfef91557f9a70cff5a90accba45841a37524e9b93f98a97b20f6b2b69e5db" [[containers]] source = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:82cfef91557f9a70cff5a90accba45841a37524e9b93f98a97b20f6b2b69e5db" -
You can manually embed any container image by adding it to an image builder blueprint file using the following example:
Example section for manually embedding container image to a blueprint[[containers]] source = "<my_image_pullspec_with_tag_or_digest>"Replace
<my_image_pullspec_with_tag_or_digest>with the exact reference to a container image used by the MicroShift version you are deploying.