hackoregon / backend-examplar-2018

an example dockerized geo-aware django backend
MIT License
4 stars 5 forks source link

Docker push fails due to failed "aws ecr get-login" command #58

Closed MikeTheCanuck closed 6 years ago

MikeTheCanuck commented 6 years ago

Last year's API projects all used the following code to authenticate to ECR and upload the newly-built docker image:

    echo Getting the ECR login...
    eval $(aws ecr get-login --region $AWS_DEFAULT_REGION)
    echo Running docker push command...
    docker push "$DOCKER_REPO"/"$DEPLOY_TARGET"/"$DOCKER_IMAGE":latest

The Travis logs for a recent attempt at using this now in a 2018 API project, resulted in two new problems we've never seen before:

...
Getting the ECR login...
unknown shorthand flag: 'e' in -e
See 'docker login --help'.
...

Then later, as the docker push command attempts to write to the ECR repo: no basic auth credentials

MikeTheCanuck commented 6 years ago

It appears one possible solution to this is adding the --no-include-email flag to the aws ecr get-login command: https://stackoverflow.com/questions/44722341/docker-login-unknown-shorthand-flag-e

This flag is available in awscli v1.11.91, and as of today Travis installs v1.15.13 when running pip install --upgrade awscli.

znmeb commented 6 years ago

Hmmm ... looks like it's not logging into the image repository - thats' $DOCKER_REPO. Is there a docker login somewhere before the push?

MikeTheCanuck commented 6 years ago

The --no-include-email flag definitely fixed this error.