Interview Prep/AWS/Containers and Serverless

How do you authenticate Docker to ECR?

BeginnerConceptContainers and Serverless
Answer

ECR issues a token valid for 12 hours, retrieved with the CLI and piped to Docker.

aws ecr get-login-password --region ap-south-1 | \
  docker login --username AWS --password-stdin 123456789012.dkr.ecr.ap-south-1.amazonaws.com
docker push 123456789012.dkr.ecr.ap-south-1.amazonaws.com/api:1.4.2

The caller needs ecr:GetAuthorizationToken plus push/pull permissions on the repository.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on Containers and Serverless