1

From OSX, I'm just following the guide you can find here (detailed repro steps below): https://console.aws.amazon.com/ecs/home?region=us-east-1#/repositories/create

aws-cli/1.10.24 Python/2.7.10 Darwin/15.4.0 botocore/1.4.15

Docker version 1.11.1, build 5604cbe (The new beta)

Everything goes fine until the push command, which fails with:

no basic auth credentials

I saw someone w/ the same error here: Can't push image to Amazon ECR - fails with "no basic auth credentials" Unfortunately, my issue doesn't seem to have to do with mismatched access keys. I've reset them several times to check.

Here are the steps I've taken:

➜  eval $(aws ecr get-login --region us-east-1)
Warning: '-e' is deprecated, it will be removed soon. See usage.
Login Succeeded
~/projects/pw/docker/aws-wordpress ‹master ✗›  (ruby-2.3.1) (5.11.0) ()

➜  docker build -t testing .
Sending build context to Docker daemon 38.91 kB
Step 1 : FROM wordpress:latest
 ---> 81aa77247862
...etc...
Removing intermediate container c5849505c95d
Successfully built 63b304c8227a
~/projects/pw/docker/aws-wordpress ‹master ✗›  (ruby-2.3.1) (5.11.0) ()

➜  docker tag testing:latest MYACCOUNT.dkr.ecr.us-east-1.amazonaws.com/testing:latest
~/projects/pw/docker/aws-wordpress ‹master ✗›  (ruby-2.3.1) (5.11.0) ()

➜  docker push MYACCOUNT.dkr.ecr.us-east-1.amazonaws.com/testing:latest
The push refers to a repository [MYACCOUNT.dkr.ecr.us-east-1.amazonaws.com/testing]
d80ff78e2dbe: Preparing
...etc...
23b28a7c4771: Waiting
6eb35183d3b8: Waiting
no basic auth credentials
Community
  • 1
  • 1
Jeff D
  • 2,164
  • 2
  • 24
  • 39

3 Answers3

2

To be able to push to ecr, you need to log into the ecr docker repo. For that you will need to setup ur access key (with privilege to ecr) using aws configure.

and then execute

eval $(aws ecr get-login --region us-east-1)

once successful, you should see Login Succeeded

Shibashis
  • 8,023
  • 3
  • 27
  • 38
  • Thank you for your input shib, I should have been more clear on everything I'd done. I've updated the question with detailed steps to reproduce – Jeff D May 14 '16 at 01:03
  • can you please check your ~/.docker/config.json and share whats the repo endpoint for ecr saved as? – Shibashis May 14 '16 at 06:40
  • Thank you for that check! It looks like I was getting an auth code for some other account. Not sure how since I'd reset the credentials, but I was able to get an appropriate login by passing in the --registry-ids flag. – Jeff D May 16 '16 at 14:39
  • Great. Adding the AWS ecr cli documentation link for future references.http://docs.aws.amazon.com/cli/latest/reference/ecr/get-login.html – Shibashis May 16 '16 at 15:48
0

As a complement to Shibashis, you can try adding -no-include-email:

eval $(aws ecr get-login --no-include-email | sed 's|https://||')
KeyMaker00
  • 6,194
  • 2
  • 50
  • 49
0

For more clarity,

Before using the push command did you do docker login to AWS from your terminal?

If you are wondering how you can get the login cmd, did you notice that AWS itself generates this command by aws ecr get-login this command?

Do docker login -u AWS -p <hashpassword-from-aws-ecr-cmd>

and do

docker push <ecr-repo-url>

Cheers!

Abhi
  • 3,361
  • 2
  • 33
  • 38