Skip to content
Latchkey

Amazon ECR "name unknown: The repository ... does not exist" in CI

Unlike some registries, ECR does not create a repository on first push. If the repo name in your tag has not been created in that account and region, the push fails with "name unknown: The repository ... does not exist". Create it once with the CLI or Terraform.

What this error means

docker push to ECR fails with "name unknown: The repository with name 'app' does not exist in the registry with id '123456789012'".

docker
name unknown: The repository with name 'app' does not exist in the registry
with id '123456789012'

Common causes

The repository was never created in ECR

ECR requires the repository to exist before a push. A new image name has no repo, so the push is rejected.

Right name, wrong account or region

The repo exists, but the tag points at a different registry id or region where it does not, so ECR reports it missing.

How to fix it

Create the repository before pushing

  1. Create the ECR repository in the correct account and region.
  2. Confirm the tag host and repo name match exactly.
  3. Re-run the push.
Terminal
aws ecr create-repository --repository-name app --region us-east-1

Manage the repository as code

Define the ECR repository in Terraform/CloudFormation so it always exists before CI pushes.

main.tf
resource "aws_ecr_repository" "app" {
  name = "app"
}

How to prevent it

  • Create ECR repositories ahead of the first push.
  • Verify the registry id and region in the image tag.
  • Provision repositories via IaC, not ad hoc.

Frequently asked questions

What causes ""The repository ... does not exist""?
ECR requires the repository to exist before a push. A new image name has no repo, so the push is rejected.
How do I fix "The repository ... does not exist"?
Create the repository before pushing

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card