-
AWS ECR(Elastic Container Registry) 생성하기Cloud/AWS 2024. 11. 6. 09:27
Amazon Web Services(AWS)는 확장 가능하고 신뢰할 수 있는 클라우드 컴퓨팅 플랫폼으로,
서버, 스토리지, 데이터베이스 등 IT 인프라를 인터넷을 통해 손쉽게 제공받을 수 있게 해주는 강력한 서비스입니다.
Certified Practitioner for Platform Operations(CPPO) 진행하면서 해본 것을 복귀하는 내용입니다.
▶ 내용
Amazon ECR(Amazon Elastic Container Registry)는 AWS에서 제공하는
컨테이너 이미지 저장 및 관리 서비스입니다.
ECR은 Docker 및 Kubernetes와 같은 컨테이너 오케스트레이션 툴과 통합되며
안전하고 확장성 높은 이미지 저장소를 제공합니다.
ECR의 이미지 저장소는 퍼블릭 및 프라이빗으로 구분되며, 접근 권한은 IAM 정책으로 제어할 수 있습니다.
이미지 스캔 기능을 통해 보안 취약점을 식별할 수 있으며, VPC 엔드포인트와 연결해 네트워크 내에서
안전하게 이미지를 전송할 수 있습니다.
ECR은 다른 AWS 서비스와 원활히 연동되어 CI/CD 파이프라인 구축에 용이합니다.
▶ 설정
>'Amazon ECR' 생성
검색에서 'Amazon ECR' 검색하여 생성하도록 합니다.
> 이미지 PUSH
친절하게 '푸시 명령 보기' 라는 항목을 클릭하면 자세하게 안내대로 따라가면 됩니다.
> Docker login
ecr에 접속정보를 통해서 docker login
[명령어] aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 890742581270.dkr.ecr.ap-northeast-2.amazonaws.com [결과] Login Succeeded
> 테스트 이미지 PULL
push 테스트를 진행하기 위해서 test Image를 public registry에서 당겨옵니다.
[명령어] docker pull hello-world [결과] Using default tag: latest latest: Pulling from library/hello-world 478afc919002: Pull complete Digest: sha256:d211f485f2dd1dee407a80973c8f129f00d54604d2c90732e8e320e5038a0348 Status: Downloaded newer image for hello-world:latest docker.io/library/hello-world:latest What's next: View a summary of image vulnerabilities and recommendations → docker scout quickview hello-world [확인 명령어] docker images hello-world REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest ee301c921b8a 18 months ago 9.14kB
> 테스트 이미지 '이름 변경'
이미지의 이름은 Registry의 address 임으로 생성한 ecr 주소로 옳바르게 변경합니다.
[명령어] docker tag hello-world:latest 890742581270.dkr.ecr.ap-northeast-2.amazonaws.com/testkior/repo-kior:hello-world [확인 명령어1] docker images 890742581270.dkr.ecr.ap-northeast-2.amazonaws.com/testkior/repo-kior REPOSITORY TAG IMAGE ID CREATED SIZE 890742581270.dkr.ecr.ap-northeast-2.amazonaws.com/testkior/repo-kior hello-world ee301c921b8a 18 months ago 9.14kB [확인 명령어2] docker images hello-world REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest ee301c921b8a 18 months ago 9.14kB
> 테스트 이미지 PUSH
Amazon ECR로 이미지를 PUSH 밀어 넣습니다.
[명령어] docker push 890742581270.dkr.ecr.ap-northeast-2.amazonaws.com/testkior/repo-kior:hello-world [결과] The push refers to repository [890742581270.dkr.ecr.ap-northeast-2.amazonaws.com/testkior/repo-kior] 12660636fe55: Pushed hello-world: digest: sha256:a8ea96bb64d60208d6a56712042d1cf58aa4a7d3751b897b9320b0813c81cbb4 size: 524
▶ Draw.io
▶ 결론
ecr를 생성하는 것은 어렵지 않습니다.
많은 분들이 자격증명을 통한 로그인 부분을 어려워 하는 것 같습니다.
'Cloud > AWS' 카테고리의 다른 글
AWS EKS DashBoard(ver.k8s) 배포하기 (4) 2024.11.08 Private Amazon EKS kubectl 연결하기. (2) 2024.11.07 Private Amazon EKS NodeGroup 생성하기 (2) 2024.11.05 Private Amazon EKS 구성하기 (2) 2024.11.04 AWS Transit Gateway & Attachment 설정하기 (1) 2024.10.31