Go to the console -> ECR -> create a Repository
Now, create a private repository, name your repository and click on create.
Our Private Repository has been created.
Launch an EC2 instance and SSH into it and install Docker in the instance.
sudo yum update
sudo yum search docker
sudo yum info docker
sudo yum install docker
sudo systemctl enable docker
Now, docker is installed , we will create the image now
mkdir shruti
cd shruti
vim Dockerfile
write this content in the Dockerfile
Now to run and build the image , use the following commands
docker build -t awsimage1:v1 .
docker run -dit awsimage1:v1
check the image and the running containers by these commands, respectively
docker images
docker ps
Our Image is now created
Go to the Repo that we have created in step1 and click on the "view push commands".
Now configure aws-cli to get the password for login into the repository.
aws configure
Access Key ID [None]: Access Key
AWS Secret Access Key [None]: Secret Key
Default region name [None]:
Default output format [None]:
It will ask for username and password configure your aws-cli and type this command to get the password
Take the repo ID and Login using the command with username and password
Rename your image to the repo name
docker tag awsimage1:latest 655645242246.dkr.ecr.ap-south-1.amazonaws.com/shruti-test1:latest
And, push into the Repository
docker push 655645242246.dkr.ecr.ap-south-1.amazonaws.com/shruti-test1:latest
Now, our image has been pushed into the repository
Go to the ECR -> Repositories ->
And, we can pull the Image using the command
docker pull 655645242246.dkr.ecr.ap-south-1.amazonaws.com/shruti-test1:latest