Chapter 2. Installing and publishing a bootc image to a registry


MicroShift is built and published as image mode containers. When installing a Red Hat Enterprise Linux (RHEL) bootable container image with MicroShift, use either a prebuilt bootable container image or build your own custom bootable container image.

Before you use image mode for RHEL, ensure that the following resources are available:

  • A RHEL 9.6 host with an active Red Hat subscription for building MicroShift bootc images.
  • A remote registry for storing and accessing rhel-bootc images.
  • An AArch64 or x86_64 system architecture.

The workflow for using image mode for RHEL with MicroShift includes the following steps:

  1. Find and use a prebuilt MicroShift container image to install RHEL.
  2. If the prebuilt MicroShift container image requires customization, build a custom MicroShift container image.
  3. Run the container image.
Important

The rpm-ostree file system used by RHEL for Edge is not supported in image mode for RHEL. Do not use the rpm-ostree file system to modify deployments that use image mode for RHEL.

2.2. Get or build your bootc image

Either get an existing bootc image or create one, then you can publish that image to a remote registry for use.

You can use the MicroShift container images to install image mode for RHEL.

Prerequisites

  • You have an x86_64 or AArch64 platform.
  • You have access to the registry.redhat.io registry.

Procedure

  1. Navigate to the Red Hat Ecosystem Catalog.
  2. Search for the MicroShift container image by using the microshift-bootc keyword.
  3. Open the container image page of the MicroShift container image.
  4. See the Overview and Technical Information tabs to get more details about the image.
  5. Select the Get this image tab to view instructions for downloading the image.
  6. Get access to the latest image on x86_64 and AArch64 platforms by logging into the registry using the following command:

    $ sudo podman login registry.redhat.io
    Copy to Clipboard Toggle word wrap
  7. Download the bootc image by running the following command:

    $ podman pull registry.redhat.io/openshift4/microshift-bootc-rhel9:v4.19
    Copy to Clipboard Toggle word wrap

2.2.2. Building the bootc image

Build your Red Hat Enterprise Linux (RHEL) that contains MicroShift as a bootable container image by using a Containerfile.

Prerequisites

  • A RHEL 9.6 host with an active Red Hat subscription for building MicroShift bootc images and running containers.
  • You logged into the RHEL 9.6 host by using the user credentials that have sudo permissions.
  • The rhocp and fast-datapath repositories are accessible in the host subscription. The repositories do not necessarily need to be enabled on the host.
  • You have a remote registry such as {quay} for storing and accessing bootc images.
  • You used the dnf install -y container-tools command to install the container-tools meta-package on the host. The meta-package contains all container tools, such as Podman, Buildah, and Skopeo for additional support and troubleshooting. These tools are required for obtaining assistance from Red Hat Support when you are building and installing the image.

Procedure

  1. Create a Containerfile that includes the following instructions:

    Example Containerfile for RHEL image mode

    FROM registry.redhat.io/rhel9/rhel-bootc:9.6
    
    ARG USHIFT_VER=4.19
    RUN dnf config-manager \
            --set-enabled rhocp-${USHIFT_VER}-for-rhel-9-$(uname -m)-rpms \
            --set-enabled fast-datapath-for-rhel-9-$(uname -m)-rpms
    RUN dnf install -y firewalld microshift && \
        systemctl enable microshift && \
        dnf clean all
    
    # Create a default 'redhat' user with the specified password.
    # Add it to the 'wheel' group to allow for running sudo commands.
    ARG USER_PASSWD
    RUN if [ -z "${USER_PASSWD}" ] ; then \
            echo USER_PASSWD is a mandatory build argument && exit 1 ; \
        fi
    RUN useradd -m -d /var/home/redhat -G wheel redhat && \
        echo "redhat:${USER_PASSWD}" | chpasswd
    
    # Mandatory firewall configuration
    RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
        firewall-offline-cmd --zone=trusted --add-source=10.42.0.0/16 && \
        firewall-offline-cmd --zone=trusted --add-source=169.254.169.1
    
    # Create a systemd unit to recursively make the root filesystem subtree
    # shared as required by OVN images
    RUN cat > /etc/systemd/system/microshift-make-rshared.service <<'EOF'
    [Unit]
    Description=Make root filesystem shared
    Before=microshift.service
    ConditionVirtualization=container
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/mount --make-rshared /
    [Install]
    WantedBy=multi-user.target
    EOF
    RUN systemctl enable microshift-make-rshared.service
    Copy to Clipboard Toggle word wrap

Podman uses the host subscription information and repositories inside the container when building the container image. If the rhocp and fast-datapath repositories are not available on the host, the build fails.

  1. Set the PULL_SECRET environment variable:

    $ PULL_SECRET=~/.pull-secret.json
    Copy to Clipboard Toggle word wrap
  2. Configure the USER_PASSWD environment variable:

    $ USER_PASSWD=<redhat_user_password> 
    1
    Copy to Clipboard Toggle word wrap
    1
    Replace <redhat_user_password> with your password.
  3. Configure the IMAGE_NAME environment variable:

    $ IMAGE_NAME=microshift-4.19-bootc
    Copy to Clipboard Toggle word wrap
  4. Create a local bootc image by running the following image build command:

    $ sudo podman build --authfile "${PULL_SECRET}" -t "${IMAGE_NAME}" \
        --build-arg USER_PASSWD="${USER_PASSWD}" \
        -f Containerfile
    Copy to Clipboard Toggle word wrap
    Important

    How secrets are used during the image build:

    • The podman --authfile argument is required to pull the base rhel-bootc:9.6 image from the registry.redhat.io registry.
    • The build USER_PASSWD argument is used to set a password for the redhat user.

Verification

  1. Verify that the local MicroShift bootc image was created by running the following command:

    $ sudo podman images "${IMAGE_NAME}"
    Copy to Clipboard Toggle word wrap

    Example output

    REPOSITORY                       TAG         IMAGE ID      CREATED        SIZE
    localhost/microshift-4.19-bootc  latest      193425283c00  2 minutes ago  2.31 GB
    Copy to Clipboard Toggle word wrap

Publish your bootc image to the remote registry so that the image can be used for running the container on another host, or for when you want to install a new operating system with the bootc image layer.

Prerequisites

  • You are logged in to the RHEL 9.6 host where the image was built using the user credentials that have sudo permissions.
  • You have a remote registry such as {quay} for storing and accessing bootc images.
  • You created the Containerfile and built the image.

Procedure

  1. Set the REGISTRY_URL variable for the image by running the following command:

    $ REGISTRY_URL=<quay.io> 
    1
    Copy to Clipboard Toggle word wrap
    1
    Replace <quay.io> with the URL for your image registry.
  2. Log in to your remote registry by running the following command:

    $ sudo podman login "${REGISTRY_URL}"
    Copy to Clipboard Toggle word wrap
  3. Set the IMAGE_NAME variable for the image by running the following command:

    $ IMAGE_NAME=<microshift-4.19-bootc> 
    1
    Copy to Clipboard Toggle word wrap
    1
    Replace <microshift-4.19-bootc> with the name of the image you want to publish.
  4. Set the REGISTRY_IMG variable for the image by running the following command:

    $ REGISTRY_IMG=<myorg/mypath>/"${IMAGE_NAME}" 
    1
    Copy to Clipboard Toggle word wrap
    1
    Replace <myorg/mypath> with your remote registry organization name and path.
  5. Publish the image by running the following command:

    $ sudo podman push localhost/"${IMAGE_NAME}" "${REGISTRY_URL}/${REGISTRY_IMG}"
    Copy to Clipboard Toggle word wrap

Verification

  1. Run the container using the image you pushed to your registry as described in the "Running the MicroShift bootc container" section.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat