OS Image mode 실습해보기 ~!
페이지 정보
작성자 OSworker 아이디로 검색 전체게시물 댓글 0건 조회 71회 좋아요 1회 작성일 25-09-16 21:23본문
안녕하세요 오늘은 130번에서 설명한 이미지모드에대해 직접 실습해보려합니다.
1. Bootable Container Image 만들기
- Container file 확인
# cat Containerfile
FROM registry.redhat.io/rhel10/rhel-bootc:10.0
ADD etc /etc
RUN dnf install -y httpd
RUN systemctl enable httpd
- 이미지 빌드
# podman build -t rhel.aodny7uz8gzf.instruqt.io:5000/test-bootc .
- 이미지 생성 확인
# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
rhel.aodny6ua9gzf.instruqt.io:5000/test-bootc latest 1fdbbe6e6ef6 8 minutes ago 1.59 GB
registry.redhat.io/rhel10/rhel-bootc 10.0 7afc07d230d0 8 days ago 1.5 GB
registry.redhat.io/rhel10/bootc-image-builder 10.0 77a181bb79a 19 days ago 508 MB
docker.io/library/registry 2 28b0eb03618e 21 months ago 26 MB
# podman push rhel.aodny7uz8gzf.instruqt.io:5000/test-bootc
2. VM QCOW2 image 만들기
- VM image 만들기
# podman run --rm --privileged \
--volume .:/output \
--volume ./config.json:/config.json \
--volume /var/lib/containers/storage:/var/lib/containers/storage \
registry.redhat.io/rhel10/bootc-image-builder:10.0 \
--type qcow2 \ // 여기서 포맷을 바꿀수있습니다.
--config config.json \
rhel.qwh0ne2tepgr.instruqt.io:5000/test-bootc
> 지원되는 포맷
--type qcow2 → disk.qcow2
--type iso → disk.iso
--type raw → disk.raw
--type vhdx → disk.vhdx
--type ami → AMI
- 생성된 이미지 확인
# ls -l qcow2/
-rw-r--r--. 1 root root 1008992256 Aug 26 02:14 disk.qcow2
3. VM 생성 및 부팅하기
# virt-install --name bootc-vm \
--disk /var/lib/libvirt/images/bootc10.0-vm.qcow2 \
--import \
--memory 2048 \
--graphics none \
--osinfo rhel9-unknown \
--noautoconsole \
--noreboot
# virsh list --all
Id Name State
-----------------------------
- bootc-vm shut off
이렇게 가상화가능한 이미지를 만들어봤습니다.
- 단점으로는 기본적으로 /etc, /var, /user만 쓰기가 가능합니다.
| 디렉터리 | 읽기/쓰기 | 용도 |
|---|---|---|
| /etc | Writeable | 시스템 설정 변경 |
| /var | Writeable | 로그, 상태, 캐시 |
| /usr | 일부 Writeable | 패키지 상태, 사용자 설치 프로그램 |
| 나머지 / | Read-only | 실행 파일, 라이브러리, 핵심 시스템 |
감사합니다.
댓글목록
등록된 댓글이 없습니다.


Top