2

I'm trying to push a docker image to aws by using Invoke-Expression -Command (Get-ECRLoginCommand -Region us-east-2).Command

but i Just want to know the correct format of this command to push the image

Yashika
  • 21
  • 2

1 Answers1

2

From your question, it seems you want to push or pull the image from ECR. Here are the steps

  1. configure first aws configure using aws-cli or assign role if you are on the remote server
  2. then open the aws console of ECR if you are in us-west-2 or change the region repositories region us-west-2
  3. click on your repository and the select view push command enter image description here

Here is the command for window

Invoke-Expression -Command (Get-ECRLoginCommand -Region us-west-2).Command

The command for Linux/Mac

$(aws ecr get-login --no-include-email --region us-west-2)

update:

This command retrieves and displays an authentication token using the GetAuthorizationToken API that you can use to authenticate to an Amazon ECR registry.

aws ecr get-login-password --region $AWS_REGION

get-login-password

Adiii
  • 54,482
  • 7
  • 145
  • 148
  • yes i'm using windows command for pushing an image but it says that the Invoke-Expression command is not found – Yashika Jul 25 '19 at 05:22
  • so its related to this https://stackoverflow.com/questions/21095493/invoke-expression-command-not-finding-file-even-though-it-exists – Adiii Jul 25 '19 at 05:28
  • Since `get-login` is deprecated and replaced with `get-login-password`, is there another way to retrieve a Docker login command to the default registry? – lkisac Nov 13 '22 at 20:05
  • yes `aws ecr get-login-password --region $AWS_REGION` – Adiii Nov 14 '22 at 05:00