5.11. bootc-image-builder를 사용하여 상태 비저장 PXE 이미지 빌드


bootc-image-builder 툴을 사용하여 네트워크 부팅에 적합한 kernel, initrd, squashfs rootfs와 같은 아티팩트 세트를 사용하여 bootc 컨테이너 이미지를 pxe-tar-xz 이미지 유형으로 변환할 수 있습니다.

사전 요구 사항

  • bootc 컨테이너입니다.
  • dracut-livesquashfs-tools 패키지는 Containerfile에 포함되어 있습니다.
  • 컨테이너 이미지는 initramfs 에 빌드된 dmsquash-live 모듈을 사용하여 빌드됩니다. 예를 들어 Containerfile을 참조하십시오.
  • 생성된 아티팩트를 호스팅하는 기능적 TFTP 또는 HTTP 서버입니다.

프로세스

  1. 컨테이너 파일을 생성합니다.

    FROM quay.io/<namespace>/<image>:latest
    RUN dnf -y install dracut-live squashfs-tools && dnf clean all
    # Override using composefs for ostree (it is incompatible with the squashfs rootfs)
    RUN cat <<EOF > /usr/lib/ostree/prepare-root.conf
    [composefs]
    enabled = no
    [sysroot]
    readonly = true
    EOF
    # Include the dmsquash-live module in the initramfs
    RUN cat <<EOF > /usr/lib/dracut/dracut.conf.d/40-pxe.conf
    compress="xz"
    add_dracutmodules+=" qemu qemu-net livenet dmsquash-live "
    early_microcode="no"
    EOF
    
    # Rebuild the initrd
    RUN set -xe; kver=$(ls /usr/lib/modules); env DRACUT_NO_XATTR=1 dracut -vf /usr/lib/modules/$kver/initramfs.img "$kver"
    
    # Mask services that aren't compatible with running from the rootfs
    RUN systemctl mask bootc-generic-growpart.service bootc-publish-rhsm-facts.service
    RUN bootc container lint
  2. 컨테이너 이미지를 빌드합니다.

    $ podman build -f ./Containerfile -t bootc-dracut
  3. bootc-image-builder 를 실행하여 tar 파일을 생성합니다.

    $ mkdir -p ./output
    $ sudo podman run \
        --rm \
        -it \
        --privileged \
        --pull=newer \
        --security-opt label=type:unconfined_t \
        -v ./config.toml:/config.toml:ro \
        -v ./output:/output \
        registry.redhat.io/rhel10/bootc-image-builder:latest \
        --type pxe-tar-xz \
        --local \
        localhost/bootc-dracut:latest

    Containerfile이 원격 시스템에 있는 경우 localhost/bootc-dracut:latest 를 올바른 URL로 바꿉니다.

    생성된 tar 파일은 패키지 기반 pxe-tar-xz 이미지와 동일합니다. 유일한 차이점은 grub.cfg 파일에 ostree=…​ 이 커널 명령줄에 추가되었으며 rootfs.img 파일은 패키지 기반 시스템 대신 OSTree 시스템입니다.

검증

배포하기 전에 컨테이너 이미지가 올바르게 빌드되었으며 필요한 구성 파일과 모듈이 포함되어 있는지 확인합니다.

  1. 빌드한 컨테이너를 검사합니다.

    $ podman run --rm -it localhost/bootc-dracut:latest /usr/bin/bash
  2. /usr/lib/ostree/prepare-root.conf/usr/lib/dracut/dracut.conf.d/40-pxe.conf 파일이 올바르게 생성되었는지 확인합니다.
  3. initramfs 모듈을 확인하여 dmsquash-liveostree 모듈이 있는지 확인합니다.

    $ lsinitrd --mod /usr/lib/modules//initramfs.img*

문제 해결

GRUB 메뉴를 사용할 수 없음
  • 원인: EFI 바이너리 또는 구성 파일이 잘못 배치됩니다.
  • 해결 방법: grub.cfg 파일이 grubx64.efi 파일과 동일한 디렉토리에 있는지 확인합니다. BOOTX64.EFI,grubx64.efigrub.cfg 파일을 TFTP 서버가 가리키는 디렉터리의 루트에 배치합니다.
rootfs.img 파일이 로드되지 않음
  • 원인: [FAILED] initrd-switch-root.service - Switch Root를 시작할 수 없습니다.
  • 해결 방법: initramfs에 dmsquash-live 모듈이 포함되어 있는지 확인합니다.
  • 원인: curlrootfs.img 파일을 다운로드하려고 하는 루프에 붙어 있습니다. Warning: failed to download live image: error 253
  • 해결 방법: grub.cfg 파일에서 rootfs.img 파일이 root=live:…​ 에 지정된 위치에 있는지 확인합니다. HTTP 서버 로그를 확인하여 요청 경로가 예상 위치와 일치하는지 확인합니다.
OSTree root가 마운트되지 않음
  • 원인: ostree-prepare-root: 지정된 OSTree 루트를 찾을 수없음
  • 해결 방법: grub.cfg 파일이 동일한 tar 파일에서 시작된 rootfs.img 파일과 일치하는지 확인합니다. grub.cfg 파일의 ostree=…​ 항목은 rootfs.img 파일의 경로를 가리켜야 합니다. 빌드 프로세스에서 OSTree 디렉터리에서 이 UUID를 설정하기 때문에 rootfs.img 파일이 grub.cfg 파일과 일치하지 않을 때 불일치가 발생합니다.
  • 원인: composefs를 마운트하지 못했습니다: composefs: failed to mount: Input/output error
  • 해결 방법: prepare-root.conf 파일에서 composefs 가 비활성화되어 있는지 확인합니다.
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동