Nov 8, 2022

Lab Guide:Amazon Elastic Container Registry (Amazon ECR)

Let's take you through AWS managed container image registry.
Nandani Sah
Nandani SahSoftware Engineer In Platforms - I
lines

Container Management

AWS managed container image registry is secure, scalable, and reliable. The Amazon ECR supports private repositories with resource-based permissions using AWS IAM. This ensures that specified users or Amazon EC2 instances can access your container repositories and images. You can use your preferred CLI to push, pull, and manage Docker images, Open Container Initiative (OCI) images, and OCI-compatible artifacts.

Follow the above steps:

Step 1: Create an Ubuntu Server/Instance and SSH into it.

Step1: Create an Ubuntu Server/Instance and SSH into it.

Step 2: Select the instance and click on Actions.

Step2: Select the instance and click on Actions.

Step 3: Click on Security and then click on Modify IAM role.

Step3: Click on Security and then click on Modify IAM role.

Step 4: Click on create new IAM role.

Step 4: Click on create new IAM role.

Step 5:Click on Create Role.

Step 5:Click on Create Role.

Step 6: Choose EC2 and click on next.

Step 6: Choose EC2 and click on next.

Step 7: Attach ECR and EKS policies to the role and press next : same way attach ECR and EKS full access to IAM User also.

Step 7: Attach ECR and EKS policies to the role and press next : same way attach ECR and EKS full access to IAM User also.

Step 8: Provide the role name.

Step 8: Provide the role name.

Step 9: Click on create role.

Step 9: Click on create role.

Step 10: Come back to the instance and attach the IAM role to the instance and click on “Update IAM role”.

Step 10: Come back to the instance and attach the IAM role to the instance and click on “Update IAM role”.

Step 11: SSH into the server/Instance.

Step 11: SSH into the server/Instance.

Step 12: Become Root User.

Step 12: Become Root User.

Step 13: Install AWS CLI(Command line Interface).

Step 13: Install AWS CLI(Command line Interface).

Step 14: Configure the AWS CLI.

Note: Use the following command.

Note: Provide environment variables such as (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION).

Step 14: Configure the AWS CLI.

Step 15: Install Docker.

Step 15: Install Docker.

Step 16: Create a Container Repository.

Step 16: Create a Container Repository.

Step 17: Go to AWS Container Registry service, their one repository will be created by the name hello world.

Step 17: Go to AWS Container Registory service, their one repository will be created by the name hello world.

Step 18: Login to the repo using below command.

Step 18: Login to the repo using below command.

Step 19: Pull an image from docker hub.

Step 19: Pull an image from docker hub.

Step 20: Tag the image to push to your repository.

Note: replace underlined words region and aws_account_id with your region and account ID.

Step 21: Push the image.

Note: replace underlined words region and aws_account_id with your region and account ID.

Step 21: Push the image.

Step 22: Go to container registory service in AWS and check “the hello-world image would be pushed” with the tag name “latest”.

Step 22: Go to container registory service in AWS and check “the hello-world image would be pushed” with the tag name “latest”.

The above diagram shows the image has been pushed to the registry [Amazon ECR] which makes easier for us to create a container anytime using above image in the registry.

You can further read: Reference for ECR using CLI

Hire our Development experts.