18.5. 컨테이너에서 Buildah 실행
이 절차에서는 컨테이너에서 Buildah를 실행하고 이미지를 기반으로 작동하는 컨테이너를 생성하는 방법을 설명합니다.
사전 요구 사항
-
container-tools
모듈이 설치되어 있습니다.
절차
registry.redhat.io 레지스트리에 로그인합니다.
$ podman login registry.redhat.io Username: myuser@mycompany.com Password: <password> Login Succeeded!
registry.redhat.io/rhel8/buildah
이미지를 가져와 실행합니다.# podman run --rm --device /dev/fuse -it \ registry.redhat.io/rhel8/buildah /bin/bash
-
rm 옵션은
컨테이너가
종료된 후registry.redhat.io/rhel8/buildah
이미지를 제거합니다. -
device
옵션은
컨테이너에 호스트 장치를 추가합니다. -
sys_chroot
- 다른 루트 디렉터리로 변경할 수 있습니다. 컨테이너의 기본 기능에는 포함되어 있지 않습니다.
-
rm 옵션은
registry.access.redhat.com/ubi8
이미지를 사용하여 새 컨테이너를 생성합니다.# buildah from registry.access.redhat.com/ubi8 ... ubi8-working-container
ubi8-working-container
컨테이너 내부에서ls /
명령을 실행합니다.# buildah run --isolation=chroot ubi8-working-container ls / bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv
선택 사항: 로컬 스토리지의 모든 이미지를 나열합니다.
# buildah images REPOSITORY TAG IMAGE ID CREATED SIZE registry.access.redhat.com/ubi8 latest ecbc6f53bba0 5 weeks ago 211 MB
선택 사항: 작업 중인 컨테이너 및 해당 기본 이미지를 나열합니다.
# buildah containers CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME 0aaba7192762 * ecbc6f53bba0 registry.access.redhat.com/ub... ubi8-working-container
선택 사항:
registry.access.redhat.com/ubi8
이미지를 registry.example.com에 있는 로컬 레지스트리로 푸시합니다.
# buildah push ecbc6f53bba0 registry.example.com:5000/ubi8/ubi
추가 리소스