AWS

ECR 사용

kyeongjun-dev 2021. 11. 29. 13:58

ECR 로그인

Bastion 인스턴스에서 aws cli가 설치된 상태에서 아래 명령어를 수행한다. account ID와 region은 개개인에게 맞게 입력(Bastion 인스턴스는 amazon linux이므로 aws cli가 이미 설치되어 있는 상태)

aws ecr get-login-password --region <region ex) ap-northeast-2> | docker login --username AWS --password-stdin <계정 ID>.dkr.ecr.<region ex) ap-northeast-2>.amazonaws.com

 

성공하면 아래와 같이 표시된다. 실제로 .docker/config.json 파일을 가지고 있으면 ecr에 대한 작업을 수행할 수 있다.

WARNING! Your password will be stored unencrypted in /home/ec2-user/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded