2.3. ブループリントのカスタマイズと Containerfile のカスタマイズの対応表
次の表には、ブループリントのカスタマイズオプションと、Containerfile で使用される同等のコマンドが含まれています。
| ブループリント | コマンド指示 |
|---|---|
| distro = "rhel-10." | FROM rhel-bootc:10 |
| [[packages]] name = "openssh-server" version = "8.*" などと指定します。 | RUN dnf install <package name> |
| [[groups]] name = "anaconda-tools" | RUN dnf group install <group_name> |
| [[containers]] source = "quay.io/rhel/rhel:latest" | RUN podman pull docker.io/library/postgres:alpine |
| [customizations.kernel] name = "kernel-debug" append = "nosmt=force" |
RUN mkdir -p /usr/lib/bootc/kargs.d RUN cat <<`EOF` >> /usr/lib/bootc/kargs.d/console.toml kargs = ["console=ttyS0,114800n8","kernel-debug"] match-architectures = ["x86_64"] |
| [customizations.rhsm.config.dnf_plugins.product_id] enabled = true [customizations.rhsm.config.dnf_plugins.subscription_manager] enabled = true [customizations.rhsm.config.subscription_manager.rhsm] manage_repos = true [customizations.rhsm.config.subscription_manager.rhsmcertd] auto_registration = true | COPY ./rhsm.conf /etc/rhsm/rhsm.conf |
| [customizations.rpm.import_keys] files = [ "/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-18-primary", "/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-19-primary" ] | RUN mkdir -p /etc/pki/rpm-gpg/ COPY <host_path>/gpg_key /etc/pki/rpm-gpg//gpg_key |
| [[customizations.sshkey]] user = "root" key = "PUBLIC SSH KEY" | # SSH keys COPY test.pub container_key.pub RUN mkdir -p .ssh && \ cat container_key.pub >> .ssh/authorized_keys && \ chmod 600 .ssh/authorized_keys && \ rm -f container_path_to_key.pub |
| [customizations.timezone] timezone = "US/Eastern" ntpservers = ["0.north-america.pool.ntp.org", "1.north-america.pool.ntp.org"] | RUN ln -sf /usr/share/zoneinfo/Asia/Bangkok /etc/localtime |
| [customizations.locale] languages = ["en_US.UTF-8"] keyboard = "us" |
RUN cat <<`EOF` >> /etc/locale.conf LANG="en_US.UTF-8" |
| [customizations.firewall] ports = ["22:tcp", "80:tcp", "imap:tcp", "53:tcp", "53:udp", "30000-32767:tcp", "30000-32767:udp"] | RUN dnf install -y firewalld && \ dnf clean all && \ firewall-offline-cmd --new-zone=customzone && \ firewall-offline-cmd --zone=customzone --set-description="Custom firewall rules for the container" && \ firewall-offline-cmd --zone=customzone --add-service=ftp && \ firewall-offline-cmd --zone=customzone --add-service=ntp && \ firewall-offline-cmd --zone=customzone --add-service=dhcp && \ firewall-offline-cmd --zone=customzone --add-port=22/tcp && \ firewall-offline-cmd --zone=customzone --add-port=80/tcp && \ firewall-offline-cmd --zone=customzone --add-port=53/tcp && \ firewall-offline-cmd --zone=customzone --add-port=53/udp && \ firewall-offline-cmd --zone=customzone --add-port=30000-32767/tcp && \ firewall-offline-cmd --zone=customzone --add-port=30000-32767/udp && \ firewall-offline-cmd --set-default-zone=customzone |
| [[customizations.directories]] path = "/etc/<dir-name>" mode = "0755" user = "root" group = "root" ensure_parents = false | #Directory: RUN mkdir /etc/<dir> RUN chown -R admin:wheel /etc/<dir> && \ chmod -R 644 /etc/<dir> #Files: RUN touch /etc/<myfile> RUN chown :widget /etc/<myfile> && \ chmod 600 /etc/<myfile> |
| [customizations] installation_device = "/dev/sda" |
RUN mkdir -p /usr/lib/bootc/kargs.d && \ cat <<`EOF` >> /usr/lib/bootc/kargs.d/console.toml kargs = ["inst.device=/dev/sda"] |
| [customizations.ignition.embedded] config = "eyJpZ25pdG….xIn1dfX0=" |
RUN mkdir -p /usr/lib/bootc/kargs.d && \ cat <<`EOF` >> /usr/lib/bootc/kargs.d/console.toml kargs = ["ignition.config.url=http://192.168.122.1/fiot.ign","rd.neednet=1"] |
| [customizations.fdo] manufacturing_server_url = "http://192.168.122.199:8080" diun_pub_key_insecure = "true" di_mfg_string_type_mac_iface = "enp2s0" | RUN dnf install -y fdo-init fdo-client && \ systemctl enable fdo-client-linuxapp.service |
| [customizations.openscap] datastream = "/usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml" profile_id = "xccdf_org.ssgproject.content_profile_cis" [customizations.openscap.json_tailoring] profile_id = "<name-of-profile-used-in-json-tailoring>-file" filepath = "/some/path/tailoring-file.json" [[customizations.files]] path = "/the/path/tailoring-file.json" data = "<json-tailoring-file-contents>" | RUN dnf install -y openscap-utils && \ autotailor --output /some/path/tailoring-file.json \ --new-profille-id xccdf_org.ssgproject.content_profile_cis |
| [customizations] fips = true |
RUN mkdir -p /usr/lib/bootc/kargs.d && \ cat <<`EOF` >> /usr/lib/bootc/kargs.d/01-fips.toml kargs = ["fips=1"] |
2.3.1. image mode for RHEL を使用して同様の RHEL for Edge イメージを作成する リンクのコピーリンクがクリップボードにコピーされました!
image mode for RHEL を使用してエッジイメージを作成するには、OSTree コミットと共通のパッケージで足りないものを手動でインストールする必要があります。これらのパッケージのほとんどは bootc イメージに含まれていますが、次のパッケージが欠けています。
-
clevis -
clevis-dracut -
clevis-luks -
greenboot -
greenboot-default-health-checks -
fdo-client -
fdo-owner-cli
不足しているパッケージをインストールし、同様の RHEL for Edge イメージを作成するには、次の手順に従います。
前提条件
- 既存の RHEL for Edge rpm-ostree ベースのデプロイ済みシステム。
手順
次の内容の Containerfile を作成します。
FROM registry.io.redhat.com/rhel10/rhel-bootc:latest RUN dnf install -y \ clevis \ clevis-dracut \ clevis-luks \ greenboot \ greenboot-default-health-checks \ fdo-client \ fdo-owner-cli # (Optionl) Extra packages often used in edge # RUN dnf install -y # dracut-config-generic \ # platform-python \ # pinentry \ # firewalld \ # iptables \ # NetworkManager-wifi \ # NetworkManager-wwan \ # wpa_supplicant \ # traceroute \ # rootfiles \ # policycoreutils-python-utils \ # setools-console \ # rsync \ # usbguard RUN systemctl enable NetworkManager.service \ greenboot-grub2-set-counter.service \ greenboot-grub2-set-success.service \ greenboot-healthcheck.service \ greenboot-rpm-ostree-grub2-check-fallback.service \ greenboot-status.service \ greenboot-task-runner.service redboot-auto-reboot.service \ redboot-task-runner.service"同様の RHEL for Edge のカスタマイズされた bootc イメージを構築します。
$ podman build -t quay.io/<namespace>/<image>:<tag> .オプション: イメージをプッシュします:
$ podman push quay.io/<namespace>/<image>:<tag>
検証
すべてのイメージをリスト表示します。
$ podman images