2.4. RHEL for Edge 이미지와의 기능 일치를 위해 이미지 모드 사용
표준 bootc 이미지에는 일반적으로 OSTree 커밋의 일부인 특정 패키지가 포함되어 있지 않습니다. RHEL for Edge 설정과 일치하려면 이러한 패키지를 수동으로 설치해야 합니다.
누락된 패키지는 다음을 포함합니다.
-
clevis,clevis-dracut,clevis-luks -
greenboot,greenboot-default-health-checks -
fdo-client,fdo-owner-cli
사전 요구 사항
-
기존 RHEL for Edge
rpm-ostree 기반시스템입니다.
프로세스
컨테이너
파일에 누락된 패키지를 추가합니다.FROM registry.redhat.io/rhel10/rhel-bootc:latest RUN dnf install -y \ clevis \ clevis-dracut \ clevis-luks \ greenboot \ greenboot-default-health-checks \ fdo-client \ fdo-owner-cli # (Optional) 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"에지 bootc 이미지를 위해 사용자 지정된 RHEL을 빌드합니다.
$ podman build -t quay.io/<namespace>/<image>:<tag> .선택 사항: 이미지를 푸시합니다.
$ podman push quay.io/<namespace>/<image>:<tag>
검증
모든 이미지를 나열합니다.
$ podman images
2.4.1. 이미지 모드를 사용하여 RHEL 9.6 이상의 이미지 빌드 링크 복사링크가 클립보드에 복사되었습니다!
RHEL 9.6 이상에서는 이미지 모드를 사용하여 부팅 가능한 컨테이너 이미지를 구성하고 에지 배포를 위한 디스크 이미지를 생성할 수 있습니다. 에지 호스트에 대한 RHEL 시스템의 이미지 모드를 생성하려면 Containerfile에 구성을 정의합니다. 그런 다음 bootc-image-builder 툴을 사용하여 배포 가능한 아티팩트를 출력합니다.
이미지 모드는 컨테이너 네이티브 워크플로우에 권장되는 경로이지만 RHEL 이미지 빌더를 사용하여 표준 RHEL 9.6 이상 에지 이미지를 생성할 수 있습니다. RHEL for Edge 이미지 구성, 설치 및 관리를 참조하십시오.
사전 요구 사항
- Podman이 호스트에 설치되어 있습니다.
-
bootc-image-builder툴을 실행하는 root 액세스 권한과--privileged모드에서 컨테이너를 실행하여 이미지를 빌드합니다.
프로세스
컨테이너
파일을생성합니다. 다음 예제에는 필수 패키지 및 커널 인수가 포함되어 있습니다.$ cat Containerfile FROM registry.redhat.io/rhel9/rhel-bootc:9.6 # Packages RUN dnf install -y zsh && dnf clean all # Group install RUN dnf group -y install "Development Tools" # Hostname RUN echo "rock.paper.scissor" > /etc/hostname # Kernel 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"] EOF # Subscription-manager RUN dnf install subscription-manager # RPM config RUN mkdir -p /etc/pki/rpm-gpg/ COPY <host_path>/gpg_key /etc/pki/rpm-gpg/gpg_key # Timezones RUN cat <<EOF >> /etc/localtime Asia/Bangkok EOF # Locale RUN cat <<EOF >> /etc/locale.conf LANG="en_US.UTF-8" EOF && \ cat <<EOF >> /etc/vconsole.conf KEYMAP=us EOF # firewall RUN dnf install -y firewalld && \ mkdir -p /etc/firewalld/zones RUN cat <<EOF >> /etc/firewalld/zones/customzone.xml <?xml version="1.0" encoding="utf-8"?> <zone> <short>Customzone</short> <description>Custom firewall rules for the container.</description> <!-- Allowed services --> <service name="ftp"/> <service name="ntp"/> <service name="dhcp"/> <!-- Blocked services (not explicitly listed) --> <!-- Removing telnet explicitly is unnecessary if it is not included --> <!-- Open specific ports --> <port protocol="tcp" port="22"/> <port protocol="tcp" port="80"/> <port protocol="tcp" port="53"/> <port protocol="udp" port="53"/> <port protocol="tcp" port="30000-32767"/> <port protocol="udp" port="30000-32767"/> </zone> EOF RUN firewall-offline-cmd --set-default-zone=customzone # systemd services RUN systemctl enable sshd #ignition 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"] EOF #fdo RUN dnf install -y fdo-init fdo-client && \ systemctl enable fdo-client-linuxapp.service #Repositories RUN mkdir -p /etc/yum.repos.d COPY custom.repo /etc/yum.repos.d/custom.repo #fips RUN mkdir -p /usr/lib/bootc/kargs.d && \ cat <<EOF >> /usr/lib/bootc/kargs.d/01-fips.toml kargs = ["fips=1"] EOF RUN dnf install -y crypto-policies-scripts && update-crypto-policies --no-reload --set FIPS<
image>를 빌드합니다. 현재 디렉터리에서Containerfile을 사용합니다.$ podman build -t quay.io/<namespace>/<image>:<tag> .
검증
모든 이미지를 나열합니다.
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE quay.io/<namespace>/<image> latest b28cd00741b3 About a minute ago 2.1 GB