18.5. 컨테이너에서 Buildah 실행

이 절차에서는 컨테이너에서 Buildah를 실행하고 이미지를 기반으로 작동 중인 컨테이너를 생성하는 방법을 보여줍니다.

사전 요구 사항

  • container-tools meta-package가 설치되어 있습니다.

절차

  1. registry.redhat.io 레지스트리에 로그인합니다.

    $ podman login registry.redhat.io
    Username: myuser@mycompany.com
    Password: <password>
    Login Succeeded!
  2. registry.redhat.io/rhel9/buildah 이미지를 가져와서 실행합니다.

    # podman run --rm --device /dev/fuse -it \
      registry.redhat.io/rhel9/buildah /bin/bash
    • --rm 옵션은 컨테이너가 종료된 후 registry.redhat.io/rhel9/buildah 이미지를 제거합니다.
    • device 옵션 은 컨테이너에 호스트 장치를 추가합니다.
    • sys_chroot - 다른 루트 디렉터리로 변경할 수 있습니다. 컨테이너의 기본 기능에는 포함되어 있지 않습니다.
  3. registry.access.redhat.com/ubi9 이미지를 사용하여 새 컨테이너를 생성합니다.

    # buildah from registry.access.redhat.com/ubi9
    ...
    ubi9-working-container
  4. ubi9-working-container 컨테이너 내에서 ls / 명령을 실행합니다.

    # buildah run --isolation=chroot ubi9-working-container ls /
    bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv
  5. 선택 사항: 로컬 스토리지의 모든 이미지를 나열합니다.

    # buildah images
    REPOSITORY                        TAG      IMAGE ID       CREATED       SIZE
    registry.access.redhat.com/ubi9   latest   ecbc6f53bba0   5 weeks ago   211 MB
  6. 선택 사항: 작업 중인 컨테이너 및 해당 기본 이미지를 나열합니다.

    # buildah containers
    CONTAINER ID  BUILDER  IMAGE ID     IMAGE NAME                       CONTAINER NAME
    0aaba7192762     *     ecbc6f53bba0 registry.access.redhat.com/ub... ubi9-working-container
  7. 선택 사항: registry.access.redhat.com/ubi9 이미지를 registry.example.com 에 있는 로컬 레지스트리로 푸시합니다.

    # buildah push ecbc6f53bba0 registry.example.com:5000/ubi9/ubi