Push docker image to amazon ecs repository
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Strictly speaking, Amazon ECS does not host Docker images. ECS runs containers, while Amazon ECR stores the container images that ECS tasks pull at deployment time. So when people say "push a Docker image to an ECS repository," the repository they actually mean is almost always ECR.
The workflow is simple: create or choose an ECR repository, log Docker in to ECR, tag the image with the repository URI, and push it. After that, reference the image URI from your ECS task definition or service.
Build or Choose the Local Image
Start with a local Docker image. For example:
You can confirm it exists with:
If the image was already built by CI or another process, you can skip this step and use the existing local tag.
Create an Amazon ECR Repository
If the repository does not exist yet, create it with the AWS CLI:
The response includes the repository URI, which looks like this:
That URI is what Docker needs for tagging and pushing.
Authenticate Docker to ECR
Before Docker can push to ECR, log in with an ECR authorization token:
Related reading
- Push docker image to amazon ecs repository
- PWD is not set in ENV instruction in a Dockerfile
- Python service uses 100 of CPU on while loop with sleep inside docker container
- Rabbitmq connection refused from Docker container to local host
- Push Messages from AWS Lambda to Kafka
- Python 3 Boto 3, AWS S3 Get object URL
- PyLint message logging-format-interpolation
- Python client euqivelent of kubectl rollout restart deployment

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.