DEV Community

Roman
Roman

Posted on

AWS Elastic Container Registry Cheat Sheet

Amazon Elastic Container Registry (Amazon ECR) - Fully managed container registry offering high-performance hosting, so you can reliably deploy application images and artifacts anywhere

Alternatives

  • Docker Hub
  • JFrog Artifactory
  • Azure Container Registry
  • Harbor
  • Google Container Registry
  • Red Hat Quay
  • JFrog Container Registry

Quick start

  • Login
    • get-login-password:aws ecr get-login-password --region region | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com
  • Create a repository:

    aws ecr create-repository \
        --repository-name hello-repository \
        --image-scanning-configuration scanOnPush=true \
        --region region
    
  • Tag image

    • docker tag hello-world:latest aws_account_id.dkr.ecr.region.amazonaws.com/hello-repository
  • Push

    • docker push aws_account_id.dkr.ecr.region.amazonaws.com/hello-repository
  • Pull

    • docker pull aws_account_id.dkr.ecr.region.amazonaws.com/hello-repository:latest
  • Delete an image

    aws ecr batch-delete-image \
        --repository-name hello-repository \
        --image-ids imageTag=latest \
        --region region
    
  • Delete a repository

    aws ecr delete-repository \
      --repository-name hello-repository \
      --force \
      --region region
    

Top comments (0)