클라우드/OpenShift

[OpenShift] 사용자 지정 Apache 컨테이너 이미지 생성

세브웁스 2023. 6. 1. 12:00
반응형
실습 환경 : Redhat WorkStation

해당 작업 전 실습환경 구축

https://shyen.tistory.com/92

 

[OpenShift] 실습 환경 구축

0. 실습 환경 구축 0.1. 실습 환경 구축 [student@workstation ~]$ lab-configure · Enter the GitHub account name: yourgituser 1 Verifying GitHub account name: yourgituser · Enter the Quay.io account name: yourquayuser 2 Verifying Quay.io account

shyen.tistory.com


1. 강의 실습 시작

[student@workstation ~]$ lab image-operations start

 

2. Quay.io 로그인

[student@workstation ~]$ podman login quay.io

 

3. Httpd 이미지를 이용하여 컨테이너 시작

[student@workstation ~]$ podman run -d --name official-httpd \
> -p 8180:80 quay.io/redhattraining/httpd-parent

 

4. 컨테이너 내부 터널 접속

[student@workstation ~]$ podman exec -it official-httpd /bin/bash

 

5. Index 페이지 수정

bash-4.4# echo "DO180 Page" > /var/www/html/do180.html

 

6. 홈페이지 접속하여 페이지 내용 확인

[student@workstation ~]$ curl 127.0.0.1:8180/do180.html

 

7. 아파치 컨테이너 수정사항 확인

[student@workstation ~]$ podman diff official-httpd

 

8. 아파치 컨테이너 중지

[student@workstation ~]$ podman stop official-httpd

 

9.아파치 컨테이너 수정

[student@workstation ~]$ podman commit -a 'Your Name' \
> official-httpd do180-custom-httpd

 

10. 로컬에 있는 컨테이너 이미지 확인

[student@workstation ~]$ podman images

 

11. 환경 변수 로드

[student@workstation ~]$ source /usr/local/etc/ocp4.config

  

12. 이미지에 태그 지정

[student@workstation ~]$ podman tag do180-custom-httpd \
> quay.io/${RHT_OCP4_QUAY_USER}/do180-custom-httpd:v1.0

 

13. 새 이름 캐시에 추가되었는지 확인

[student@workstation ~]$ podman images

 

14. 이미지 Quay.io 레지스트리에 게시

[student@workstation ~]$  podman push \
> quay.io/${RHT_OCP4_QUAY_USER}/do180-custom-httpd:v1.0

 

15. 게시한 컨테이너 이미지 사용 가능 확인

[student@workstation ~]$ podman pull \
> -q quay.io/${RHT_OCP4_QUAY_USER}/do180-custom-httpd:v1.0

 

16. 새로 게시된 이미지로 컨테이너 생성

[student@workstation ~]$ podman run -d --name test-httpd -p 8280:80 \
> ${RHT_OCP4_QUAY_USER}/do180-custom-httpd:v1.0

 

17. 이미지 내용 확인

[student@workstation ~]$ curl http://localhost:8280/do180.html

 

18. 실습 강의 종료

[student@workstation ~]$ lab image-operations finish
반응형