Red Hat Training

A Red Hat training course is available for RHEL 8

7.2. UBI 마이크로 이미지 사용

Buildah 툴을 사용하여 ubi-micro 컨테이너 이미지를 빌드할 수 있습니다.

사전 요구 사항

  • container-tools 모듈이 설치되어 있습니다.

사전 요구 사항

  • containers-tool 모듈에서 제공하는 podman 툴이 설치됩니다.

절차

  1. registry.access.redhat.com/ubi8/ubi-micro 이미지를 가져와서 빌드합니다.

    # microcontainer=$(buildah from registry.access.redhat.com/ubi8/ubi-micro)
  2. 작동하는 컨테이너 루트 파일 시스템을 마운트합니다.

    # micromount=$(buildah mount $microcontainer)
  3. micromount 디렉터리에 httpd 서비스를 설치합니다.

    # yum install \
        --installroot $micromount \
        --releasever 8 \
        --setopt install_weak_deps=false \
        --nodocs -y \
        httpd
    # yum clean all \
        --installroot $micromount
  4. 작업 컨테이너에서 루트 파일 시스템을 마운트 해제합니다.

    # buildah umount $microcontainer
  5. 작업 중인 컨테이너에서 ubi-micro-httpd 이미지를 만듭니다.

    # buildah commit $microcontainer ubi-micro-httpd

검증 단계

  1. ubi-micro-httpd 이미지에 대한 세부 정보를 표시합니다.

    # podman images ubi-micro-httpd
    localhost/ubi-micro-httpd latest 7c557e7fbe9f  22 minutes ago  151 MB