11.5. システムグループへの更新のデプロイ


Containerfile を変更することで、オペレーティングシステムの設定を変更できます。コンテナーイメージをビルドしてレジストリーにプッシュし、オペレーティングシステムを再起動すると、更新が適用されます。

bootc switch コマンドを使用して、コンテナーイメージソースを変更することもできます。コンテナーレジストリーの内容によって、RHEL Image Mode オペレーティングシステムの具体的な設定が決まります。コンテナーイメージ参照の切り替え を参照してください。

通常、システムグループに更新をデプロイする場合、セントラル管理サービスを使用できます。これにより、各システムにインストールされ、セントラルサービスに接続するクライアントを提供できます。多くの場合、管理サービスでは、クライアントが 1 回限りの登録を実行する必要があります。

以下は、システムグループに更新をデプロイする例です。必要に応じて、管理サービスの認証情報をイメージに注入して変更することで、永続的な systemd サービスを作成できます。

注記

理解しやすいように、以下の例の Containerfile は最適化されていません。たとえば、イメージ内に複数のレイヤーが作成されないように最適化するには、RUN を 1 回だけ呼び出します。

Image Mode for RHEL イメージにクライアントをインストールし、起動時にクライアントを実行してシステムを登録できます。

前提条件

  • 管理クライアントが、cron ジョブまたは別の systemd サービスを使用して、今後のサーバーへの接続を処理する。

手順

  • 次の特徴を持つ管理サービスを作成します。管理サービスは、システムをいつアップグレードするかを決定します。

    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. ベースイメージに bootc-fetch-apply-updates.timer が含まれている場合は無効にします。
    2. dnf を使用するか、クライアントに適用される他の方法を使用してクライアントをインストールします。
    3. 管理サービスの認証情報をイメージに注入します。
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る