6.3. runc 및 crun을 사용하여 컨테이너 실행
runc 또는 crun을 사용하면 컨테이너는 번들을 사용하여 구성됩니다. 컨테이너의 번들은 config.json 이라는 사양 파일과 루트 파일 시스템이 포함된 디렉터리입니다. 루트 파일 시스템에는 컨테이너 내용이 포함됩니다.
< ;runtime>은 crun 또는 runc일 수 있습니다.
사전 요구 사항
-
container-tools모듈이 설치되어 있습니다.
절차
registry.access.redhat.com/ubi8/ubi컨테이너 이미지를 가져옵니다.# podman pull registry.access.redhat.com/ubi8/ubiregistry.access.redhat.com/ubi8/ubi이미지를rhel.tar 아카이브로 내보냅니다.# podman export $(podman create registry.access.redhat.com/ubi8/ubi) > rhel.tarbundle/rootfs디렉토리를 생성합니다.# mkdir -p bundle/rootfsrhel.tar아카이브를bundle/rootfs디렉터리에 추출합니다.# tar -C bundle/rootfs -xf rhel.tar번들에 대해
config.json이라는 새 사양 파일을 생성합니다.# <runtime> spec -b bundle-
b옵션은 번들 디렉터리를 지정합니다. 기본값은 현재 디렉터리입니다.
-
선택 사항: 설정을 변경합니다.
# vi bundle/config.json번들에
myubi라는 컨테이너 인스턴스를 생성합니다.# <runtime> create -b bundle/ myubimyubi컨테이너를 시작합니다.# <runtime> start myubi
컨테이너 인스턴스의 이름은 호스트에 고유해야 합니다. 컨테이너의 새 인스턴스를 시작하려면 # <runtime> start <container_name>
검증
<
runtime> :에의해 시작된 컨테이너를 나열합니다.# <runtime> list ID PID STATUS BUNDLE CREATED OWNER myubi 0 stopped /root/bundle 2021-09-14T09:52:26.659714605Z root