Lesson 29 of 30
This platform's Docker track already covers what a registry is and why 'build once, promote everywhere' matters. ECR is that same idea, made concrete on AWS — and its two real differences from Docker Hub both come from being AWS-native, not from being a different kind of registry.
10 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
How does authenticating to push an image to ECR differ from authenticating to Docker Hub?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
ECR (Elastic Container Registry) is AWS's own container image registry — the same role Docker Hub plays generically, covered in this platform's Docker track's registry lesson: a place images are pushed to and pulled from, tagged and promoted between environments the same way. What's actually different about ECR isn't the registry concept itself; it's two things that follow directly from being AWS-native rather than a separate service with its own account system:
aws ecr get-login-password mints a short-lived registry token from whatever IAM identity is already making the call — the same role an EC2 instance, a Lambda function, or a CI pipeline already has, rather than a second credential system to manage and rotate separately.aws ecr get-login-password --region us-east-1 \
| docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com
docker tag myapp:a1b2c3d 123456789012.dkr.ecr.us-east-1.amazonaws.com/myapp:a1b2c3d
docker push 123456789012.dkr.ecr.us-east-1.amazonaws.com/myapp:a1b2c3d
The get-login-password step is the meaningful difference from Docker Hub: it exchanges the caller's existing IAM credentials for a registry token valid for a matter of hours, rather than a persistent login that stays valid until manually revoked. Everything after that — the git-SHA tagging strategy, docker tag adding a name to an existing image rather than rebuilding it, docker push — is exactly the same "build once, promote the same image" pattern from the Docker track's registry lesson, just pointed at ECR's registry URL instead of Docker Hub's.
docker login against ECR has to be re-run periodically (via get-login-password again) because the token expires in hours, whereas a Docker Hub login persists until explicitly logged out — a deliberate consequence of using IAM-based short-lived credentials, not a bug or inconvenience to work around."How would you set up a container registry for a team's CI/CD pipeline on AWS?" tests whether a candidate names ECR specifically and reasons about IAM-based auth and scan-on-push as concrete answers — versus re-explaining what a registry is in general, which this platform's Docker track already covers and an AWS-specific question is assuming as known.