7.3. runc 및 crun을 사용하여 컨테이너 실행
runc 또는 crun을 사용하면 컨테이너는 번들을 사용하여 구성됩니다. 컨테이너 번들은 config.json 이라는 사양 파일과 루트 파일 시스템을 포함하는 디렉터리입니다. 루트 파일 시스템에는 컨테이너의 콘텐츠가 포함되어 있습니다.
<runtime> 은 crun 또는 runc일 수 있습니다.
사전 요구 사항
-
container-toolsmeta-package가 설치되어 있습니다.
절차
registry.access.redhat.com/ubi9/ubi컨테이너 이미지를 가져옵니다.# podman pull registry.access.redhat.com/ubi9/ubiregistry.access.redhat.com/ubi9/ubi이미지를rhel.tar아카이브로 내보냅니다.# podman export $(podman create registry.access.redhat.com/ubi9/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
옵션은번들 디렉터리를 지정합니다. 기본값은 현재 디렉터리입니다.
-
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