0
votes

Hi I am able to deploy my spring boot application in my local docker container(1.11.2) in Windows-7.I followed the below steps to run the docker image in AWS EC2(Free Account:eu-central-1) but getting error

Step 1

Generated Amazon "AccessKeyID" and "SecretKey".

Step 2

Created new repository and it shows 5 Steps to push my docker image in AWS EC2.

Step 3

Installed Amazon CLI and run "aws configure" and configured all the details. While running aws iam list-users --output table it shows all the user list

Step 4

Run the following command in Docker Container aws ecr get-login --region us-west-2

It returns the docker login. While running the docker login it returns the following error :

XXXX@XXXX MINGW64 ~
$ docker login -u AWS -p <accessKey>/<secretKey>
Uwg
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized:
incorrect username or password

XXXX@XXXX MINGW64 ~
$ gLBBgkqhkiG9w0BBwagggKyMIICrgIBADCCAqcGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQME8
Zei
bash: gLBBgkqhkiG9w0BBwagggKyMIICrgIBADCCAqcGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQ
ME8Zei: command not found

XXXX@XXXX MINGW64 ~
$ lJnpBND9CwzAgEQgIICeLBms72Gl3TeabEXDx+YkK9ZlbyGxPmsuVI/rq81tDeIC68e0Ma+ghg3Dt
Bus
bash: lJnpBND9CwzAgEQgIICeLBms72Gl3TeabEXDx+YkK9ZlbyGxPmsuVI/rq81tDeIC68e0Ma+ghg
3DtBus: No such file or directory

I didn't get proper answer in google.It would be great if some one guide me to resolve this issue.Thanks in advance.

1
Never publish secret access keys from Amazon on any repo or pages that can be publicly available. I'm removing the keys on your post, but my recommendation is for you to reset them and get new ones, as your account could get compromised.Christian Vielma
The secret keys are still in the edit log. Revoke those keys immediately OP.slugonamission
Thank you let me revoke the keys now.VelNaga

1 Answers

0
votes

Your command is not pointing to your ECR endpoint, but to DockerHub. Using Linux, normally I would simply run:

$ eval $(aws ecr get-login --region us-west-2)

This is possible because the get-login command is a wrapper that retrieves a new authorization token and formats the docker login command. You only need to execute the formatted command (in this case with eval)

But if you really want to run the docker login manually, you'll have to specify the authorization token and the endpoint of your repository:

$ docker login -u AWS -p <password> -e none https://<aws_account_id>.dkr.ecr.<region>.amazonaws.com

Where <password> is actually the authorization token (which can be generated by the aws ecr get-authorization-token command).

Please refer to the documentation for more details: http://docs.aws.amazon.com/cli/latest/reference/ecr/index.html