Docker images push to ECR

How to Create 2 different versions of nginx images with custom static content and push them to the ECR with proper tags.

Can anyone please help with code and along with instructions or step wise execution.

Hi @rakhi.patil2

Will you be diong this on Windows or Linux?

using AWS linux image that is linux AMI

Sorry, I meant where will you be pushing the image from?
Credentials for registry push can be acquired using aws cli, and also using powershell if on windows

Anyway, the general format of an AWS ECR registry is

<account_id>.dkr.ecr.<region>.amazonaws.com

where you replace <account_id> with your 12 digit AWS account ID and <region> with the region you created the registry in, e.g. ap-southeast-1

So, build your images, then tag them for the ECR registry

docker tag <local_image>:<version> \
  <account_id>.dkr.ecr.<region>.amazonaws.com/<remote_image>:<version>

where <local_image>:<local_version> is what you created with docker build, e.g. custom-nginx:1.0 and <remote_image>:<version> can be the same, or something else (usually the same).

Now you need to docker login. The username is always AWS

Using aws cli

aws ecr get-login-password \
    --region <region> \
| docker login \
    --username AWS \
    --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com

Then you can push the image

docker push <account_id>.dkr.ecr.<region>.amazonaws.com/<your_image>:<your version> 

https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html

Thank you so much for the help and i am really grateful it’s done. one more thing i neede d like ,

  1. How can i Provision a EKS cluster in AWS using CloudFormation template(code for this)
    2.I have one nginx image created using a docker file . How can i deploy that on the above created EKS cluster.

It would be really grateful if you can please help me on this.

i need it on urgent basis , if you can help then really appreciated.

I wanted to to host a healthcare web application to be consumed by external users over the internet.
You are assigned to implement it as per the following -

  • Provision a EKS cluster in AWS using CloudFormation template
  • Make sure to follow AWS EKS best practices (maintaining security & HA)
  • Create 2 different versions of nginx images with custom static content and push them to the ECR with proper tags
  • Deploy these custom nginx images to the cluster created above
  • Both the deployed custom nginx servers should be accessible over a different path under a single domain to the end user - use Ingress for the same

I’m afraid we cannot design an entire infrastructure for you in a simple discussion forum.

If you google, there are plenty of examples of cloudformation to deploy EKS clusters, but to satisfy the criteria for security, high availability etc, really needs the input of a quality infrastructure architect.

If your boss is asking you to personally do all this, and (I’m humbly assuming you’re a junior engineer) that is very risky on his part and very unfair on you.

There’s also a lot of legal hurdles with anything to do with heathcare if there is any patient data in the system.