Docker login error cannot perform an interactive login from a non tty device

I'm trying to build my project locally using gitlab-runner on Linux. docker-build: stage: build image: docker:latest script: - docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $

I’m trying to build my project locally using gitlab-runner on Linux.

docker-build:
  stage: build
  image: docker:latest
  script:
    - docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY # user "gitlab-ci-token" is automatically created by GitLab
    - docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" target/
    - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"

Unfortunately my attempts end with error about «docker login» not being able to perform interactive login from non-TTY device.

$ gitlab-ci-multi-runner exec docker --docker-privileged docker-build
Running with gitlab-ci-multi-runner 1.11.1 (a67a225)
  on  ()
Using Docker executor with image docker:latest ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Waiting for services to be up and running...
Pulling docker image docker:latest ...
Running on runner--project-1-concurrent-0 via vanqyard...
Cloning repository...
Cloning into '/builds/project-1'...
done.
Checking out 70187b2d as docker-basic-conf...
Skipping Git submodules setup
Checking cache for docker-build/docker-basic-conf...
Successfully extracted cache
$ docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
Error: Cannot perform an interactive login from a non TTY device
ERROR: Job failed: exit code 1
FATAL: exit code 1 

My question is has anybody stumbled upon this issue and how to succesfunlly perform build?

asked Apr 6, 2017 at 7:27

asdfgh's user avatar

2

Probably not linked to the problem here, but some people might encounter the exact same message when trying a docker login from a Linux like terminal on Windows such as Git bash or Docker quickstart terminal or even Cygwin.

The trick here is to use winpty docker login

answered Apr 19, 2018 at 12:12

Victor Petit's user avatar

Victor PetitVictor Petit

2,49418 silver badges19 bronze badges

2

Most likely you did not specify the variables $CI_JOB_TOKEN and $CI_REGISTRY for the project you are working on. Note that variables are not shared and are only set per project!

That’s also why you encounter the error message

«flag needs an argument: ‘p’ in -p»

when you try to do the docker login without the quotes, which is the right way because otherwise $CI_JOB_TOKEN is not recognized as a variable, but it is simply a string consisting of two quotes, a dollar sign and the sequence of chars «CI_JOB_TOKEN».

Assuming your variables are not set and you try to execute the command

docker login -u "gitlab-ci-token" -p $CI_JOB_TOKEN $CI_REGISTRY

the variables are evaluated and your command essentially looks like that:

docker login -u "gitlab-ci-token" -p

The -p flag is not followed by a password and for that reason docker tries to initialize an interactive login.

You can verify this by trying to output your variables when you include the command echo $CI_JOB_TOKEN in your .gitlab-ci.yml

answered May 9, 2017 at 15:54

Dennis's user avatar

DennisDennis

1,74713 silver badges17 bronze badges

2

I had the same issue, but for a different cause than those already listed in here.

This is my gitlab-ci command:

docker login "${AZURE_ACR_URL}" -u "${AZURE_ACR_ACCOUNT}" -p "${AZURE_ACR_PASSWORD}"

My pipeline was running fine on the master branch, but not on other branches. Why? Because I defined the AZURE_ACR_PASSWORD variable via the settings/ci_cd feature, with the «protected» flag. After reading what this protected flag means I understood why my AZURE_ACR_PASSWORD variable could not be seen in the command:

This variable will be passed only to pipelines running on protected
branches and tags

answered Jun 26, 2018 at 12:28

claudod's user avatar

claudodclaudod

7757 silver badges8 bronze badges

3

Error: Cannot perform an interactive login from a non TTY device is your typical red herring message.
You have to look beyond the message, or rather, before. It wants to use interactive login as a fallback solution, because the previous login failed. Just like in Unix when your ssh2 auth attempt is rejected. It then prompts for username/password. Except that for emulation of Unix terminals it may fail.

The general answer to this is:
Review each of your parameters, in your command line, and make sure it is what you think it is. A trick is to precede your overall command line with echo, so as to resolve all variables…

answered Aug 6, 2020 at 11:36

Fabien Haddadi's user avatar

2

Reading how protected variables are working solved it for me. I need to perform this action inside a protected branch since I also protected my variables.

If you are not using a protected branch better remove protected variables and try again.

answered Dec 27, 2019 at 12:58

Girish kumar's user avatar

For those who are trying to ssh to a remote host for deploying a docker image via gitlab-ci:

Some variables like $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD CI_JOB_TOKEN and others are not been sent through ssh to the remote server because they are not shared vars.

You need to create a deploy token via config >> repository >> deploy token. This applies for your group or for a specific project.

Then create 2 variables on the project or group via configs >> ci /cd >> variables. The names could be MASTER_DEPLOY_USER and MASTER_DEPLOY_TOKEN

Then you could login like following

deploy-development:
  stage: deploy-development
  image: kroniak/ssh-client
  only:
    - my_development_branch
  before_script:
    - eval $(ssh-agent -s)
    - echo "$YOUR_SERVER_SSH_PRIV_KEY" | tr -d 'r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *ntStrictHostKeyChecking nonn" > ~/.ssh/config'
  script:
    - ssh-keygen -R $YOUR_REMOTE_HOST || true
    # login to docker on auth machine with deploy credentials
    - >
      ssh root@${YOUR_REMOTE_HOST}
      "docker login -u $MASTER_DEPLOY_USER -p $MASTER_DEPLOY_TOKEN $CI_REGISTRY"

Make sure you define also the other needed variables like YOUR_REMOTE_HOST and YOUR_SERVER_SSH_PRIV_KEY.

answered Jun 21, 2021 at 15:04

Helmer Barcos's user avatar

1

For those that are using variables that are set in settings of GitLab CI/CD, unmark the options protected and masked.
Optionally simply unmarking protected works fine without masked unchecked as well.

This will figure out the docker login problem.

Jose Mhlanga's user avatar

answered Jan 8, 2021 at 1:44

Natanael Weslley's user avatar

1

If you only need to log into one registry, you can get the token (from looking at .docker/config.json after a console login or sometimes via the registry itself in the case of Artifactory). Then just echo the results to .docker/config.json

echo '{ "auths": { "https://awesome_docker_repsitory.com": { "auth": "c4ajLWdpqGxhYi3xYsQ6qVa4aUefY0xbd1t6dtc4YnQ3y2DYTDoOWONx", "email": "bitbucket@foo.bar" } } }' > ~/.docker/config.json"

This performs the same action as the docker login (if you don’t have a docker credential helper that is).

answered Jul 10, 2020 at 17:29

mheyman's user avatar

mheymanmheyman

4,11336 silver badges33 bronze badges

use this bit of code instead for your docker login:

echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin

helvete's user avatar

helvete

2,33510 gold badges37 silver badges36 bronze badges

answered Aug 10, 2022 at 9:14

amirhossein nazary's user avatar

Below worked for me for Docker 1.13 ( Rhel-7.8 ):

  1. Create a file with your password / ECR key
  2. use command
    docker login --username AWS -p 'cat /data/user/ecr/key' registry-url.amazonaws.com

Note: In step 2 please replace ' with ` while using the command

Nimantha's user avatar

Nimantha

6,6716 gold badges27 silver badges66 bronze badges

answered Dec 18, 2020 at 8:26

Mayur Chavan's user avatar

Although I didn’t get this error for git-lab, I got it while pulling a different image.

The issue was with using git bash on Windows. Switch to PowerShell prompt and then try the following:

docker login

Pang's user avatar

Pang

9,344146 gold badges85 silver badges121 bronze badges

answered Jun 19, 2018 at 2:09

Utopia's user avatar

UtopiaUtopia

5211 gold badge7 silver badges13 bronze badges

In my case i was trying to connect to an AWS-Repo.

aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/XYZ

After reading the other answers i just ran the first part of the command:

aws ecr-public get-login-password --region us-east-1

This resulted in a new Error:

"...is not authorized to perform: sts:GetServiceBearerToken..."

This error message was used as the password and therefore did not work. So don’t get misdirected by the error and search for the root cause.

For AWS-User:
I added the following two Permissions:

AWSKeyManagementServicePowerUser, AWSCodeArtifactAdminAccess

answered Sep 24, 2022 at 12:28

RoJaIt's user avatar

RoJaItRoJaIt

4503 silver badges10 bronze badges

In my case, ' let variables not work

ssh xxx@xxx 'docker login ${REGISTRY} -u ${REGISTRY_USER} -p ${REGISTRY_PASSWORD} && dosomething' 

So, you should not use '. There are many ways to reach it.

answered Oct 11, 2022 at 8:53

Jessie Chen's user avatar

Jessie ChenJessie Chen

2,5261 gold badge24 silver badges31 bronze badges

CI script fail on docker login. Check if your script have access to $variables.

The issue might be because of protected and not protected branches and variables correlation.

thanks to pievee and greg-witczak

I removed protection from variable.

answered Feb 1 at 14:16

Evgene's user avatar

EvgeneEvgene

1765 bronze badges

if your here because your getting the error in git hubs workflows (actions). the easiest way to login is the docker login-action step:
https://github.com/marketplace/actions/docker-login#github-packages-docker-registry

-   name: Login to GitHub Packages Docker Registry
    uses: docker/login-action@v1
    with:
      registry: docker.pkg.github.com
      username: ${{ github.repository_owner }}
      password: ${{ secrets.GITHUB_TOKEN }}

or for windows build agents:

-   name: Login
    shell: pwsh
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    run: echo $env:GITHUB_TOKEN | docker login https://docker.pkg.github.com -u ${env:GITHUB_ACTOR} --password-stdin

answered Mar 11, 2021 at 21:05

Marinus Pfund's user avatar

2

Try this. docker login -u Username -p Password

It worked for me.

Dharman's user avatar

Dharman

29.3k21 gold badges80 silver badges131 bronze badges

answered Aug 27, 2019 at 9:38

Guru Prasad's user avatar

0

I am using Mobaxterm and starting a local bash terminal, and trying this command. But seeing an error. The same command is working from the cmd windows prompt or powershell. Any suggestions on workarounds, really appreciate it. I played with some settings that are already in the mobaxterm, but none worked.

/home/mobaxterm>docker login abcdef.azurecr.io
Error: Cannot perform an interactive login from a non TTY device

asked Oct 8, 2019 at 18:58

sbolla's user avatar

Try adding winpty before the docker ... command.

It enables TTY on Windows. Useful for GitBash, Putty and MobaXTerm.

$ winpty docker login $ACR_REGISTRY
Username: appacr
Password:
Login Succeeded

Stephen Kitt's user avatar

Stephen Kitt

388k51 gold badges996 silver badges1095 bronze badges

answered Mar 8, 2020 at 10:31

David Peleg's user avatar

1

This is a docker error. Each Repo needs to have it’s own environment variables set up. If you don’t set up the DOCKER_USERNAME and DOCKER_PASSWORD in your model in the Repository settings, it would raise that confusing docker terminal (tty) error.

answered Oct 18, 2019 at 16:53

ttfreeman's user avatar

For me, the issue was with AWS ECR and I simply needed to update my aws cli.

AWS-CLI, version 2 installation instructions for Mac:
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html

You’ll find similar instructions for other OS’s there as well.

answered Feb 29, 2020 at 3:41

Wayne F. Kaskie's user avatar

Use the --password-stdin flag as specified in the docs.

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

Greenonline's user avatar

Greenonline

1,7317 gold badges16 silver badges21 bronze badges

answered Feb 3, 2022 at 2:52

Sanfer's user avatar

SanferSanfer

1212 bronze badges

Try specifying the region in the aws ecr statement such as this example provided here:

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

When I tried this to resolve the error I also noticed that AWS is finicky (unwilling to accept reasonable mistakes, for the non-english-native users) about how you define the region variable though. For example, us-west-2, while good enough in the --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com part of the call, needed to be specified further as us-west-2b within the aws ecr get-login-password --region region portion of the command.

Hope this helps!

answered May 28, 2021 at 2:10

patataskr's user avatar

I had same issue on m1 Mac and the solution is refreshing the artifactory token.

answered Feb 1 at 15:02

Zeliha's user avatar

2

Issue

I’m trying to run docker commands in an ssh connection which was made from github actions. There I’m using even mention in the workflow. Here is my workflow

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
  pull_request:
    branches: ['main']

env:
  REGISTRY: 'ghcr.io/testing/api-gateway'
  IMAGE_NAME: ${{ format('{0}-{1}', github.event.repository.name, github.sha) }}
  USERNAME: ${{ secrets.USERNAME }}
  DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [16.x]

    steps:
      - uses: actions/[email protected]

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/[email protected]
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'
      - run: npm install
      - run: npm run build

      - name: Build & Push docker
        run: docker build -t $REGISTRY:$IMAGE_NAME .

      - name: Login to github package repository
        run: echo $DOCKER_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin

      - name: Push docker image
        run: docker push $REGISTRY:$IMAGE_NAME

  deploy:
    runs-on: ubuntu-latest
    needs: build

    steps:
      - name: Deploy to Digital Ocean droplet via SSH action
        uses: garygrossgarten/[email protected]
        with:
          host: ${{ secrets.DO_HOST }}
          username: ${{ secrets.DO_USER }}
          privateKey: ${{ secrets.DO_KEY }}
          passphrase: ${{ secrets.DO_PASSPHRASE }}
          command: |
            echo $DOCKER_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin
            docker pull $REGISTRY:$IMAGE_NAME
            docker run -p 3000:3000 $REGISTRY:$IMAGE_NAME

But I’m getting the following error when I run the workflow.

Run garygrossgarten/[email protected]
Establishing a SSH connection to ***.
using provided private key
(node:1514) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
🤝 Connected to ***.
Executing command: echo $DOCKER_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin
docker pull $REGISTRY:$IMAGE_NAME
docker run -p 3000:3000 $REGISTRY:$IMAGE_NAME
Error: Cannot perform an interactive login from a non-TTY device

invalid reference format

docker: invalid reference format.
See 'docker run --help'.

⚠️ An error happened executing the command echo $DOCKER_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin
docker pull $REGISTRY:$IMAGE_NAME
docker run -p 3000:3000 $REGISTRY:$IMAGE_NAME. Command exited with code 125
Error: Command exited with code 125
 1: 0xa1a640 node::Abort() [/home/runner/runners/2.296.0/externals/node12/bin/node]
 2: 0xa90649  [/home/runner/runners/2.296.0/externals/node12/bin/node]
 3: 0xc06599  [/home/runner/runners/2.296.0/externals/node12/bin/node]
 4: 0xc08387 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/runner/runners/2.296.0/externals/node12/bin/node]
 5: 0x140dd19  [/home/runner/runners/2.296.0/externals/node12/bin/node]

I was looking for a solution and I couldn’t find a proper one. what would be the best solution for this?

Solution

According to this other thread about the Cannot perform an interactive login from a non-TTY device message:

docker login prints this error message when you use —password-stdin,
but don’t actually send a password to the command’s stdin.

Therefore, it seems the $DOCKER_TOKEN variable is empty.

You could try using ${{ env.DOCKER_TOKEN}}, or add env: DOCKER_TOKEN: ${{ env.DOCKER_TOKEN }} in the last step of your deploy job.

Something like this:

  deploy:
    runs-on: ubuntu-latest
    needs: build

    steps:
      - name: Deploy to Digital Ocean droplet via SSH action
        uses: garygrossgarten/[email protected]
        env:
          DOCKER_TOKEN: ${{ env.DOCKER_TOKEN }}
        with:
          host: ${{ secrets.DO_HOST }}
          username: ${{ secrets.DO_USER }}
          privateKey: ${{ secrets.DO_KEY }}
          passphrase: ${{ secrets.DO_PASSPHRASE }}
          command: |
            echo $DOCKER_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin 
            # or using directly ${{ env.DOCKER_TOKEN}} instead of $DOCKER_TOKEN
            docker pull $REGISTRY:$IMAGE_NAME
            docker run -p 3000:3000 $REGISTRY:$IMAGE_NAME

Answered By — GuiFalourd

Answer Checked By — Mary Flores (WPSolving Volunteer)

Comments

@preeth1

@preeth1
preeth1

changed the title
Cannot perform an interactive login from a non TTY device when trying to use a private docker registry

«Cannot perform an interactive login from a non TTY device» when trying to use a private docker registry

Feb 27, 2020

@ericl
ericl

added
the

P1

Issue that should be fixed within a few weeks

label

Mar 5, 2020

@richardliaw
richardliaw

changed the title
«Cannot perform an interactive login from a non TTY device» when trying to use a private docker registry

[autoscaler] «Cannot perform an interactive login from a non TTY device» when trying to use a private docker registry

Apr 22, 2020

@ericl
ericl

added

P2

Important issue, but not time-critical

and removed

P1

Issue that should be fixed within a few weeks

labels

May 6, 2020

    Table of contents

  • Gitlab-runner local build — login from non TTY device
  • Piplenes: docker login can not perform an interactive login from a non TTY
  • Cannot perform an interactive login from a non TTY device
    #144
  • GitLab Forum

Find the data you need here

We provide programming data of 20 most popular languages, hope to help you!

Previous PostNext Post

Gitlab-runner local build — login from non TTY device

docker-build:
  stage: build
  image: docker:latest
  script:
    - docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY # user "gitlab-ci-token" is automatically created by GitLab
    - docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" target/
    - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
$ gitlab-ci-multi-runner exec docker --docker-privileged docker-build
Running with gitlab-ci-multi-runner 1.11.1 (a67a225)
  on  ()
Using Docker executor with image docker:latest ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Waiting for services to be up and running...
Pulling docker image docker:latest ...
Running on runner--project-1-concurrent-0 via vanqyard...
Cloning repository...
Cloning into '/builds/project-1'...
done.
Checking out 70187b2d as docker-basic-conf...
Skipping Git submodules setup
Checking cache for docker-build/docker-basic-conf...
Successfully extracted cache
$ docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
Error: Cannot perform an interactive login from a non TTY device
ERROR: Job failed: exit code 1
FATAL: exit code 1 
docker login -u "gitlab-ci-token" -p $CI_JOB_TOKEN $CI_REGISTRY
docker login -u "gitlab-ci-token" -p
docker login "${AZURE_ACR_URL}" -u "${AZURE_ACR_ACCOUNT}" -p "${AZURE_ACR_PASSWORD}"
deploy-development:
  stage: deploy-development
  image: kroniak/ssh-client
  only:
    - my_development_branch
  before_script:
    - eval $(ssh-agent -s)
    - echo "$YOUR_SERVER_SSH_PRIV_KEY" | tr -d 'r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *ntStrictHostKeyChecking nonn" > ~/.ssh/config'
  script:
    - ssh-keygen -R $YOUR_REMOTE_HOST || true
    # login to docker on auth machine with deploy credentials
    - >
      ssh [email protected]${YOUR_REMOTE_HOST}
      "docker login -u $MASTER_DEPLOY_USER -p $MASTER_DEPLOY_TOKEN $CI_REGISTRY"
echo '{ "auths": { "https://awesome_docker_repsitory.com": { "auth": "c4ajLWdpqGxhYi3xYsQ6qVa4aUefY0xbd1t6dtc4YnQ3y2DYTDoOWONx", "email": "[email protected]" } } }' > ~/.docker/config.json"

docker login
-   name: Login to GitHub Packages Docker Registry
    uses: docker/[email protected]
    with:
      registry: docker.pkg.github.com
      username: ${{ github.repository_owner }}
      password: ${{ secrets.GITHUB_TOKEN }}
-   name: Login
    shell: pwsh
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    run: echo $env:GITHUB_TOKEN | docker login https://docker.pkg.github.com -u ${env:GITHUB_ACTOR} --password-stdin
[email protected]:~$ docker -v
Docker version 19.03.7, build 7141c199a2
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 8233251134332.dkr.ecr.us-east-2.amazonaws.com/gatling-lots
[email protected]:~$ aws ecr get-login-password --region us-   
east-2 | docker login --username AWS --password-stdin 
823443336.dkr.ecr.us-west-2.amazonaws.com/gatling-lots
usage: aws [options] <command> <subcommand> [<subcommand> ...]      
[parameters]
 To see help text, you can run:

aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:

 batch-check-layer-availability           | batch-delete-image                      
 batch-get-image                          | complete-layer-upload                   
create-repository                        | delete-lifecycle-policy                 
delete-repository                        | delete-repository-policy                
 describe-images                          | describe-repositories                   
 get-authorization-token                  | get-download-url-for-layer              
 get-lifecycle-policy                     | get-lifecycle-policy-preview            
 get-repository-policy                    | initiate-layer-upload                   
 list-images                              | put-image                               
 put-lifecycle-policy                     | set-repository-policy                   
 start-lifecycle-policy-preview           | upload-layer-part                       
 get-login                                | help                                    
 Error: Cannot perform an interactive login from a non TTY device
[email protected]:~$ (aws ecr get-login --no-include-email  --region us-east-2)

docker login -u AWS -p 

MzQxL2c0Yks4RjVxeDg9IiwidmVyc2lvbiI6IjIiLCJ0eXBlIjoiREFUQV9LRVkiLCJleHBpcmF0aW9uIjoxNTgzNjgzNDY5fQ== https://825251119036.dkr.ecr.us- east-2.amazonaws.com
docker login -u AWS -p $(aws ecr get-login-password --region the-region-you-are-in) xxxxxxxxx.dkr.ecr.the-region-you-are-in.amazonaws.com
$ echo "" | docker login --password-stdin --username jorendorff
Error: Cannot perform an interactive login from a non TTY device
$curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

$aws --version

aws-cli/2.0.30 Python/3.7.3 Linux/4.14.181-142.260.amzn2.x86_64 botocore/2.0.0dev34

$aws ecr get-login-password --region your_region | docker login --username AWS --password-stdin Account_ID.dkr.ecr.your_region.amazonaws.com
aws ecr get-login-password --region <YOUR_REGION> | docker login --username AWS --password-stdin  <ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin xxxxxxxxxxxx.dkr.ecr.region.amazonaws.com --profile loadeo
unknown flag: --profile
Unable to locate credentials. You can configure credentials by running "aws configure".
aws --version
aws-cli/2.0.19 Python/3.7.7 Windows/10 botocore/2.0.0dev23
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
aws configure list
aws ecr get-login-password 
  --region <region> 
  --profile <profile> 
| docker login 
  --username AWS 
  --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
        $ aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 123456789.dkr.ecr.eu-central-1.amazonaws.com --profile myprofile
    unknown flag: --profile
    An error occurred (UnrecognizedClientException) when calling the GetAuthorizationToken operation: The security token included in the request is invalid.
    15:51 $ aws --profile myprofile ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 123456789.dkr.ecr.eu-central-1.amazonaws.com
    Login Succeeded
    ✔ ~
docker login --username=${{ secrets.ALIYUN_DOCKER_REPO_USER_NAME }} --password=${{ secrets.ALIYUN_DOCKER_REPO_USER_PASSWORD }} registry.cn-hangzhou.aliyuncs.com
Run docker login --username=*** --*** registry.cn-hangzhou.aliyuncs.com
Error: Cannot perform an interactive login from a non TTY device
Error: Process completed with exit code 1.
- name: Build image push to aliyun
  run: |
    docker login --username=${{ secrets.ALIYUN_DOCKER_REPO_USER_NAME }} --password=${{ secrets.ALIYUN_DOCKER_REPO_USER_PASSWORD }} registry.cn-hangzhou.aliyuncs.com
    docker build -f dolphin-acientbay/Dockerfile -t="${namespace}/dolphin-acientbay-service:v1.0.0" .

Piplenes: docker login can not perform an interactive login from a non TTY

denied: requested access to the resource is denied

Cannot perform an interactive login from a non TTY device
#144

An error occurred (AccessDeniedException) when calling the GetAuthorizationToken operation: User: arn:aws:iam:... is not authorized to perform: ecr:GetAuthorizationToken on resource: *
Error: Cannot perform an interactive login from a non TTY device
version: 2.1
orbs:
  aws-ecr: circleci/[email protected]

jobs:
  // other jobs to checkout code, etc
  build:
    docker:
      - image: cimg/openjdk:11.0
    steps:
      - setup_remote_docker
      - run:
           name: Build docker image
           command: // a command to build the docker image using maven
      - aws-ecr/ecr-login
      - aws-ecr/push-image:
          repo: nominee-api
          tag: '${RELEASE_VERSION},latest'

workflows:
  my-build:
    jobs:
      - checkout-code
      - build:
          requires: 
            - checkout-code
version: 2.1
orbs:
  aws-ecr: circleci/[email protected]

jobs:
  // other jobs to checkout code, etc
  build:
    machine:
      image: ubuntu-2004:202010-01
    steps:
      - run:
           name: Build docker image
           command: // a command to build the docker image using maven
      - aws-ecr/ecr-login
      - aws-ecr/push-image:
          repo: nominee-api
          tag: '${RELEASE_VERSION},latest'

workflows:
  my-build:
    jobs:
      - checkout-code
      - build:
          requires: 
            - checkout-code

GitLab Forum

stages:
  - test
  - build

variables:
  DOCKER_TLS_CERTDIR: "/certs"
  IMAGE_TAG: $CI_REGISTRY_IMAGE/employee-image:$CI_COMMIT_REF_SLUG

#some job for test stage that succeed (lint_test)

build:
  image: docker:19.03.13
  services:
    - docker:19.03.13-dind
  stage: build
  before_script:
    - echo "$DOCKER_REGISTRY_PASS" | docker login $DOCKER_REGISTRY --username $DOCKER_REGISTRY_USER --password-stdin
  script:
    - docker build -t $IMAGE_TAG .
    - docker images
    - docker push $IMAGE_TAG

Previous PostNext Post

Понравилась статья? Поделить с друзьями:
  • Docker iptables error
  • Docker initdb error directory var lib postgresql data exists but is not empty
  • Docker gpg error
  • Docker exec user process caused exec format error
  • Docker events init error