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.
More on Containers and Serverless
ECS vs EKS vs Fargate: what is the relationship?BeginnerWhat are ECS task definitions, tasks and services?BeginnerWhat are ECS capacity providers?IntermediateWhat is the difference between the ECS task role and the task execution role?IntermediateHow does `awsvpc` network mode work in ECS?IntermediateWhat deployment strategies does ECS support?Advanced