11.5. Deploying updates to system groups


You can change the configuration of your operating system by modifying the Containerfile. The update will be applied after you build and push your container image to the registry, and reboot the operating system.

You can also change the container image source by using the bootc switch command. The content in the container registry determines the specific configuration of the RHEL Image Mode operating system. See Switching the container image reference.

Usually, when deploying updates to system groups, you can use a central management service to provide a client to be installed on each system which connects to the central service. Often, the management service requires the client to perform a one time registration. The following is an example on how to deploy updates to system groups. You can modify, by injecting the credentials for the management service into the image, to create a persistent systemd service, if required.

注意

For clarity reasons, the Containerfile in the example is not optimized. For example, a better optimization to avoid creating multiple layers in the image is by invoking RUN a single time.

You can install a client into a image mode for RHEL image and run it at startup to register the system.

Prerequisites

  • The management-client handles future connections to the server, by using a cron job or a separate systemd service.

Procedure

  • Create a management service with the following characteristics. It determines when to upgrade the system.

    FROM registry.redhat.io/rhel10/rhel-bootc:latest
    # Management services determine when to upgrade the system.
    # Disable bootc-fetch-apply-updates.timer if it is included in the base image.
    RUN systemctl disable bootc-fetch-apply-updates.timer
    
    # Install the client from dnf, or some other method that applies for your client
    RUN dnf install management-client -y && dnf clean all
    
    # Inject the credentials for the management service into the image
    ARG activation_key=
    
    # The existence of .run_next_boot acts as a flag to determine if the
    # registration is required to run when booting
    RUN touch /etc/management-client/.run_next_boot
    
    COPY <<"EOT" /usr/lib/systemd/system/management-client.service
    [Unit]
    Description=Run management client at boot
    After=network-online.target
    ConditionPathExists=/etc/management-client/.run_client_next_boot
    
    [Service]
    Type=oneshot
    EnvironmentFile=/etc/management-client/.credentials
    ExecStart=/usr/bin/management-client register --activation-key ${CLIENT_ACTIVATION_KEY}
    ExecStartPre=/bin/rm -f /etc/management-client/.run_next_boot
    ExecStop=/bin/rm -f /etc/management-client/.credentials
    
    [Install]
    WantedBy=multi-user.target
    EOT
    
    # Link the service to run at startup
    RUN ln -s /usr/lib/systemd/system/management-client.service /usr/lib/systemd/system/multi-user.target.wants/management-client.service
    
    # Store the credentials in a file to be used by the systemd service
    RUN echo -e "CLIENT_ACTIVATION_KEY=${activation_key}" > /etc/management-client/.credentials
    
    # Set the flag to enable the service to run one time
    # The systemd service will remove this file after the registration completes the first time
    RUN touch /etc/management-client/.run_next_boot
    1. Disable bootc-fetch-apply-updates.timer if it is included in the base image.
    2. Install the client by using dnf, or some other method that applies for your client.
    3. Inject the credentials for the management service into the image.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部