7.2. Containerfile の例


RHCOS イメージのレイヤー化により、次のタイプのイメージを使用してカスタムレイヤーイメージを作成できます。

  • OpenShift Container Platform ホットフィックス。Customer Experience and Engagement (CEE) を使用して、ホットフィックスパッケージ を取得し、RHCOS イメージに適用することができます。場合によっては、公式の OpenShift Container Platform リリースに含まれる前に、バグ修正または機能強化が必要になることがあります。RHCOS イメージのレイヤー化により、公式にリリースされる前にホットフィックスを簡単に追加し、基になる RHCOS イメージに修正が組み込まれたときにホットフィックスを削除できます。

    重要

    一部のホットフィックスは Red Hat Support Exception を必要とし、OpenShift Container Platform のサポート範囲またはライフサイクルポリシーの通常の範囲外です。

    ホットフィックスは Red Hat ホットフィックスポリシー に基づいて提供されます。それを基本イメージ上に適用し、その新しいカスタムレイヤーイメージを非実稼働環境でテストします。カスタムレイヤーイメージが実稼働環境で安全に使用できることを確認したら、独自のスケジュールで特定のノードプールにロールアウトできます。何らかの理由で、カスタムレイヤーイメージを簡単にロールバックして、デフォルトの RHCOS の使用に戻すことができます。

    ホットフィックスを適用するクラスター上の Containerfile の例

    containerfileArch: noarch
    content: |-
      FROM configs AS final
      #Install hotfix package
      RUN dnf update -y https://example.com/files/systemd-252-46.el9_4.x86_64.rpm \
                        https://example.com/files/systemd-journal-remote-252-46.el9_4.x86_64.rpm \
                        https://example.com/files/systemd-libs-252-46.el9_4.x86_64.rpm  \
                        https://example.com/files/systemd-pam-252-46.el9_4.x86_64.rpm \
                        https://example.com/files/systemd-udev-252-46.el9_4.x86_64.rpm \
                        https://example.com/files/systemd-rpm-macros-252-46.el9_4.noarch.rpm && \
          dnf clean all && \
          ostree container commit
    Copy to Clipboard Toggle word wrap

    ホットフィックスを適用するクラスター外の Containerfile の例

    FROM quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256...
    #Install hotfix package
    RUN dnf update -y https://example.com/files/systemd-252-46.el9_4.x86_64.rpm \
                      https://example.com/files/systemd-journal-remote-252-46.el9_4.x86_64.rpm \
                      https://example.com/files/systemd-libs-252-46.el9_4.x86_64.rpm  \
                      https://example.com/files/systemd-pam-252-46.el9_4.x86_64.rpm \
                      https://example.com/files/systemd-udev-252-46.el9_4.x86_64.rpm \
                      https://example.com/files/systemd-rpm-macros-252-46.el9_4.noarch.rpm && \
        dnf clean all && \
        ostree container commit
    Copy to Clipboard Toggle word wrap

  • RHEL パッケージ。chrony、firewalld、iputils などの Red Hat Enterprise Linux (RHEL) パッケージは、Red Hat Customer Portal からダウンロードできます。

    rsyslog ユーティリティーを適用するクラスター外の Containerfile の例

    # Using a 4.18.0 image
    FROM quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256...
    # Install rsyslog package
    RUN dnf install -y rsyslog && \
        ostree container commit
    # Copy your custom configuration in
    ADD remote.conf /etc/rsyslog.d/remote.conf
    Copy to Clipboard Toggle word wrap

  • サードパーティーのパッケージ。次のタイプのパッケージなど、サードパーティーから RPM をダウンロードおよびインストールできます。

    • 最先端のドライバーとカーネルの強化により、パフォーマンスを向上させたり、機能を追加したりします。
    • 侵入の可能性と実際の侵入を調査するためのフォレンジッククライアントツール。
    • セキュリティーエージェント。
    • クラスター全体の一貫性のあるビューを提供するインベントリーエージェント。
    • SSH キー管理パッケージ。

    EPEL からのサードパーティーパッケージを適用するクラスター上の Containerfile の例

    FROM configs AS final
    
    #Enable EPEL (more info at https://docs.fedoraproject.org/en-US/epel/ ) and install htop
    RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
        dnf install -y htop && \
        dnf clean all && \
        ostree container commit
    Copy to Clipboard Toggle word wrap

    EPEL からサードパーティーパッケージを適用するクラスター外の Containerfile の例

    # Get RHCOS base image of target cluster `oc adm release info --image-for rhel-coreos`
    FROM quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256...
    
    #Enable EPEL (more info at https://docs.fedoraproject.org/en-US/epel/ ) and install htop
    RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
        dnf install -y htop && \
        dnf clean all && \
        ostree container commit
    Copy to Clipboard Toggle word wrap

    この Containerfile は、RHEL fish プログラムをインストールします。fish には追加の RHEL パッケージが必要なため、イメージはエンタイトルメントのある RHEL ホストでビルドする必要があります。RHEL エンタイトルメントを機能させるには、etc-pki-entitlement シークレットを openshift-machine-config-operator namespace にコピーする必要があります。

    RHEL 依存関係を持つサードパーティーパッケージを適用するクラスター上の Containerfile の例

    FROM configs AS final
    
    # RHEL entitled host is needed here to access RHEL packages
    # Install fish as third party package from EPEL
    RUN dnf install -y https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/f/fish-3.3.1-3.el9.x86_64.rpm && \
        dnf clean all && \
        ostree container commit
    Copy to Clipboard Toggle word wrap

    RHEL 依存関係を持つサードパーティーパッケージを適用するクラスター外の Containerfile の例

    # Get RHCOS base image of target cluster `oc adm release info --image-for rhel-coreos`
    FROM quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256...
    
    # RHEL entitled host is needed here to access RHEL packages
    # Install fish as third party package from EPEL
    RUN dnf install -y https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/f/fish-3.3.1-3.el9.x86_64.rpm && \
        dnf clean all && \
        ostree container commit
    Copy to Clipboard Toggle word wrap

マシン設定を作成した後、Machine Config Operator (MCO) は次の手順を実行します。

  1. 指定された 1 つ以上のプールの新しいマシン設定をレンダリングします。
  2. 1 つ以上のプール内のノードに対して、スケジューリング対象から外す操作とドレイン操作を実行します。
  3. 残りのマシン設定パラメーターをノードに書き込みます。
  4. カスタムレイヤーイメージをノードに適用します。
  5. 新しいイメージを使用してノードを再起動します。
重要

クラスターにロールアウトする前に、実稼働環境の外でイメージをテストすることを強く推奨します。

トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

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

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

会社概要

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

Theme

© 2025 Red Hat