개발/AWS
[ AWS ] Elastic Container Registry (ECR) 생성하기
쩨이엠
2020. 12. 31. 09:22
728x90
반응형
ECR이란 ?
컨테이너 이미지를 저장하고 관리, 배포할 수 있는 레지스트리.
AWS ECR을 사용하면 자체 컨테이너 리포지토리를 운영하거나 기본 인프라 확장에 대해 신경 쓸 필요성이 줄어들고
ECS(Elastic Container Service)를 사용하면 개발 및 배포까지 AWS에서 관리가 가능하다.
ECR 등록에 대해 cli로 하기 위해서는 docker-credential-helper가 필요하다
github.com/awslabs/amazon-ecr-credential-helper 를 참조하여 설치한다
이 포스팅 Mac OS를 기준으로 함
1. aws cli 설치
[ AWS ] AWS Cli 설치
1. 파일 다운로드 curl 명령을 사용하여 파일을 다운로드한다. -o 옵션은 다운로드한 패키지가 기록되는 파일 이름을 지정합니다. 이 예제는 AWS 가이드를 따라 AWSCLIV2.pkg로 설정하였다 최신 패키
gogo-jjm.tistory.com
2. helper 설치
$ brew install docker-credential-helper-ecr
3. aws configure setting
configure에 계정을 등록한다
$ aws configure --profile {PROFILE_ID}
$ aws configure --profile iot-dev
AWS Access Key ID [None]: xxxxxxxxxxxx
AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxxxx
Default region name [None]: ap-northeast-2
Default output format [None]: json
계정 확인은 ~/.aws/config에서 가능하다
$ cat ~/.aws/config 혹은 $ aws configure list 로 확인할것 (당연한 말이지만 Access Key와 Secret Key는 보이지 않음)
4. ECR 생성
REPOSITORY_NAME에 원하는 이름을 작성하여 생성하여 성공하면 ECR 정보가 return 된다
$ aws ecr create-repository \
--repository-name {REPOSITORY_NAME} \
--image-scanning-configuration scanOnPush=true \
--region us-east-1
--profile {PROFILE_ID}
{
"repository": {
"repositoryUri": "xxxxxxxxxxxx.dkr.ecr.ap-northeast-2.amazonaws.com/{REPOSITORY_NAME}",
"imageScanningConfiguration": {
"scanOnPush": true
},
"registryId": "xxxxxxxxxxxx",
"imageTagMutability": "MUTABLE",
"repositoryArn": "arn:aws:ecr:ap-northeast-2:xxxxxxxxxxxx:repository/{REPOSITORY_NAME}",
"repositoryName": "{REPOSITORY_NAME}",
"createdAt": 1609312293.0
}
}
AWS console 에서도 확인이 가능하다
728x90
반응형