Search code examples
amazon-web-servicesdockeramazon-ecs

Cannot perform an interactive login from a non TTY device while trying to connect Docker to ECS repository


I am trying to push a local docker image into the ECS repository I created.

Following this link link

aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin xxxxxxxxxxxx.dkr.ecr.region.amazonaws.com --profile loadeo

Errors:

unknown flag: --profile
Unable to locate credentials. You can configure credentials by running "aws configure".

I also referred to the stack overflow question on this Question. Here the accepted answer is to have awscli version two. I feel I have version 2 of cli

aws --version
aws-cli/2.0.19 Python/3.7.7 Windows/10 botocore/2.0.0dev23

In the above command if I don't use --profile I get the error.

aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin xxxxxxxxxxxxxx.dkr.ecr.region.amazonaws.com



 Unable to locate credentials. You can configure credentials by running "aws configure".
Error: Cannot perform an interactive login from a non TTY device

What is that I am missing here? Could any one please help me out with this?


Solution

  • if you need to use aws named profile of your configuration, then you can use aws cli to list the profiles

    aws configure list
    

    when you located the profile, use it in conjunction with get-login-password

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