0

My GitHub actions return the following error when I try to login to docker from Github,

Cannot perform an interactive login from a non-TTY device

Here is my sample deployment file and I have stored my docker username and DockerHub Token under the Dependabot secrets

What's wrong here?

name: deploy-auth

on:
  push:
    branches: [ "master" ]
    paths:
      - 'auth/**'

jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - run: cd auth && docker build -t myusername/auth .
    - run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD --password-stdin
      env:
        DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
        DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
    - run: docker push myusername/auth
  • Does this answer your question? [Cannot perform an interactive login from a non TTY device error from garygrossgarten/github-action-ssh@release](https://stackoverflow.com/questions/73524574/cannot-perform-an-interactive-login-from-a-non-tty-device-error-from-garygrossga) – Yogev Neumann Feb 20 '23 at 21:56

1 Answers1

-1
    - run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD --password-stdin

You already included the password on that line, so you shouldn't be requesting it from stdin. It's also a good practice to quote your variables:

    - run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
BMitch
  • 231,797
  • 42
  • 475
  • 450