본문 바로가기
개발/Linux

[Amazon ECS] 3. Amazon Elastic Container Registry에 이미지 푸시

by Allonsy 2021. 9. 10.
반응형

# Amazon Elastic Container Registry에 이미지 푸시

 

* Amazon ECR

- 관리형 AWS 도커 레지스트리 서비스

- 도커 CLI를 사용하여 이미지 푸시, 가져오기, 관리

 

1. hello-world 이미지를 저장할 Amazon ECR 리포지토리 생성

$ aws ecr create-repository --repository-name hello-repository --region region

* 결과

{
    "repository": {
        "registryId": "aws_account_id",
        "repositoryName": "hello-repository",
        "repositoryArn": "arn:aws:ecr:region:aws_account_id:repository/hello-repository",
        "createdAt": 1505337806.0,
        "repositoryUri": "aws_account_id.dkr.ecr.region.amazonaws.com/hello-repository"
    }
}

 

2. hello-world 이미지를 이전 단계의 repositoryUri 값으로 태그 지정

$ docker tag hello-world aws_account_id.dkr.ecr.region.amazonaws.com/hello-repository

 

3. asw erc get-login-password 실행, 인증할 레지스트리 URI 지정

$ aws ecr get-login-password | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com

 

4. 이전 단계의 repositoryUri 값을 사용하여 Amazon ECR로 이미지 푸시

$ docker push aws_account_id.dkr.ecr.region.amazonaws.com/hello-repository

 

# 리포지토리 삭제!! (이미지 저장 비용이 나가지 않도록 실습 후 꼭 삭제 해주세요!)

$ aws ecr delete-repository --repository-name hello-repository --region region --force
반응형

댓글