Weekend Assignment
- Like you have Code commit for Git-hub (to store code), what is that similar to Docker hub on AWS?
It is Amazon ECR (https://aws.amazon.com/ecr/)
Amazon Elastic Container Registry (ECR) is a fully managed container registry that makes it easy to store, manage, and deploy Docker, Open Container Initiative (OCI), and Amazon Machine Images (AMIs) container images. With Amazon ECR, you can store your container images in a highly available and scalable repository, and then deploy them to Amazon Elastic Container Service (ECS), Amazon Elastic Kubernetes Service (EKS), AWS Lambda, or on-premises servers. Amazon ECR also integrates with other AWS services, such as Amazon Identity and Access Management (IAM) and Amazon CloudWatch, to provide you with a secure and auditable container registry experience.
Key features of Amazon ECR:
Highly available and scalable: Amazon ECR replicates your container images across multiple Availability Zones, ensuring that your images are always available, even if an Availability Zone becomes unavailable. Amazon ECR also scales automatically to accommodate your growing container image storage needs.
Secure: Amazon ECR uses IAM to control access to your container images. With IAM, you can grant specific users or groups of users permission to push, pull, or delete container images. Amazon ECR also supports image scanning to help you identify and remediate vulnerabilities in your container images.
Auditable: Amazon ECR logs all actions that are performed on your container images, including who pushed or pulled an image, when the image was pushed or pulled, and what changes were made to the image. These logs can be used to audit the use of your container images.
Benefits of using Amazon ECR:
Reduced operational overhead: Amazon ECR is a fully managed service, so you don't need to worry about provisioning, managing, or scaling your container registry infrastructure.
Improved developer productivity: Amazon ECR makes it easy for developers to store, manage, and deploy container images. Developers can push and pull container images using their preferred CLI or SDK, and they can also use Amazon ECR to store and manage other container artifacts, such as Helm charts and Kubernetes manifests.
Reduced costs: Amazon ECR is a cost-effective way to store and manage container images. You only pay for the storage that you use, and there are no upfront costs or long-term commitments.
Use cases for Amazon ECR:
Storing and managing container images: Amazon ECR is a great place to store your container images, whether they are private or public. You can use Amazon ECR to organize your container images into repositories, and you can use IAM to control access to your repositories.
Deploying container images: Amazon ECR integrates with Amazon ECS, EKS, AWS Lambda, and other AWS services to make it easy to deploy your container images. You can use Amazon ECR to deploy container images to Amazon ECS clusters, EKS clusters, AWS Lambda functions, and on-premises servers.
Sharing container images: You can share your public container images with other AWS accounts by granting them permission to pull images from your Amazon ECR repository. You can also use Amazon ECR to share your private container images with other AWS accounts by granting them permission to pull images from your repository.
Amazon ECR is a powerful and versatile tool that can help you to store, manage, and deploy your container images. If you are using Docker, OCI, or AMIs container images, then I recommend that you consider using Amazon ECR to manage your container image registry.
- How can you pull an image from Amazon ECR ?
Why Docker
I have given you a task to run a website using Tomcat on Ubuntu.
Ubuntu OS - 4GB EC2,
AMI Packages install Website content copy Time - 1 hr Create More instances - Repeat above steps.
One time - |
Time - 1hr Base image RUN commands to install packages, copy website content. Upload you new image to dockerhub or ECR. Repeated - docker pull
docker run
Time - 2 mins.
docker pull aws_account_id.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:latest
To pull a Docker image from an Amazon ECR repository
Authenticate your Docker client to the Amazon ECR registry that you intend to pull your image from. Authentication tokens must be obtained for each registry used, and the tokens are valid for 12 hours. For more information, see Private registry authentication.
(Optional) Identify the image to pull.
You can list the repositories in a registry with the aws ecr describe-repositories command:
aws ecr describe-repositories
The example registry above has a repository called amazonlinux.
You can describe the images within a repository with the aws ecr describe-images command:
aws ecr describe-images --repository-name amazonlinux
The example repository above has an image tagged as latest and 2016.09, with the image digest.
Pull the image using the docker pull command. The image name format should be registry/repository[:tag] to pull by tag, or registry/repository[@digest] to pull by digest.
docker pull aws_account_id.dkr.ecr.us-west2.amazonaws.com/amazonlinux:latest
