What is ECR?
Amazon ECR (elastic container registry) it works like as same as the docker hub. The Docker hub is for the public. ECR provides you the facility to store your container images privately. You can use your preferred CLI to push, pull, and manage Docker images, Open Container Initiative (OCI) images, and OCI-compatible artifacts.
Features of ECR
Amazon container orchestrator integration
To obtain the correct images for your applications, all you have to do is include the Amazon ECR repository in your task or pod configuration for Amazon ECS or Amazon EKS.
OCI and Docker support
Any Docker environment, whether in the cloud, on-premises, or on your local PC, may simply access Amazon ECR. You may keep Docker container images and associated OCI artefacts in your repositories using Amazon ECR.
High availability and durability
Your container images and artefacts are stored by Amazon ECR in Amazon Simple Storage Service (S3).
Encryption
Using server-side encryption from Amazon S3, your photographs are also automatically secured while they are at rest.
AWS Marketplace
Both the containers you build and any container software you purchase from AWS Marketplace are stored by Amazon ECR.
How does it work?
Creating a new Repository
Create a new registry in the ECR.
Give a name to your registry.
After that, your Repository will be created.
Using the Repository
Firstly do configure the aws for that use the secret access key in security credentials.
To configure go to the security credentials and create a new access key. You will get the details to configure after the access key is generated.
After doing the configuration copy the code available to log in your repository
and run it.
Now build the docker image.
Before that, we will create a docker image.
Cloning the repo for the code.
The below image shows the files in the application.
Now we will run the next command docker build.
Now we will tag the image and then push it.
The image is Successfully pushed.