Elastic Container Registry (ECR)

General information about Elastic Container Registry

Overview

Amazon Elastic Container Registry (ECR)arrow-up-right is an AWS managed container image registry service for hosting Docker images, Open Container Initiative (OCI) images and OCI compatible artifacts.


Registry Configuration

URIs

public.ecr.aws/<random_value_set_by_admin>/<name>              # public repo URI
<accountId>.dkr.ecr.<region>.amazonaws.com/<repo_name>         # private repo URI

Permissions

Configured with either IAM Policy or ECR Resource Policy.

triangle-exclamation
aws --region us-east-1 ecr get-repository-policy --repository-name tyler/my-private-registry --query policyText --output text | jq
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "allow",
      "Effect": "Allow",
      "Principal": "*",
      "Action": [
        "ecr:PutImage",
        "ecr:DescribeImages",
        "ecr:ListImages",
        "ecr:DescribeRepositories",
        "ecr:GetAuthorizationToken"
      ]
    }
  ]
}

Replication

Private repositories support both cross-region and cross-account replicationarrow-up-right.


Useful CLI Commands

Login to Registry

Requires ecr:GetAuthorizationToken

Latest Method

Legacy Method

Describe Repositories

List Available Images

Push Image to Repository

You specify the Registry/Repository path i.e., 111111111111.dkr.ecr.us-east-1.amazonaws.com/tyler/my-private-registry

Then the tag of the image you want to upload i.e., ubuntu-latest


Offensive Security Tactics & Techniques

Privilege Escalation

Last updated