Tuesday, June 15, 2021

AWS ECR

 

AWS ECR (Elastic Container Repository)

Amazon ECR uses Amazon S3 for storage to make your container images highly available and accessible, allowing you to reliably deploy new containers for your applications. Amazon ECR transfers your container images over HTTPS and automatically encrypts your images at rest. Amazon ECR is integrated with Amazon Elastic Container Service (ECS), simplifying your development to production workflow.

Steps to Create ECR

Step1:- Create ECR Repo in AWS lets say testrepo

Step2:- Create A Role which has EC2RepositoryFullAccess Role

Step3:- Create An EC2 instance ( I am using AWS Ubuntu) and attach above role to this instance and also install docker in it.

Step4:- Install aws cli ( on ubuntu)

    apt install unzip -y
    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
    unzip awscliv2.zip
    sudo ./aws/install
    export PATH=/usr/local/bin:$PATH
    aws --version

Step5:- Follow the steps given on Push Commands

aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 670154208195.dkr.ecr.ap-south-1.amazonaws.com
docker pull ubuntu
docker image tag ubuntu testrepo
docker tag testrepo:latest 670154208195.dkr.ecr.ap-south-1.amazonaws.com/testrepo:latest
docker images
docker push 670154208195.dkr.ecr.ap-south-1.amazonaws.com/testrepo:latest
docker rmi testrepo ubuntu
docker rmi 670154208195.dkr.ecr.ap-south-1.amazonaws.com/testrepo
docker pull 670154208195.dkr.ecr.ap-south-1.amazonaws.com/testrepo

0 comments:

Post a Comment