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

I have a .env file with the following values set

DOCKER_USER=<my username>
DOCKER_PASSWORD=<my password>

In initialization_commands, I have the following lines:

initialization_commands: [
    "export $(xargs < ~/.env)",  # Export all .env vars to environment variables
    "sudo apt update",
    "sudo apt install docker.io -y",
    "sudo usermod -a -G docker ubuntu",
    "sudo service docker restart",
    "docker login -u $DOCKER_USER -p $DOCKER_PASSWORD",
]

But when I run ray up, I always get the following error: Error: Cannot perform an interactive login from a non TTY device

How do I fix this?

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 22 (1 by maintainers)

Most upvoted comments

$(aws ecr get-login --no-include-email --region ap-southeast-1)

Above works for me.

On Windows, try adding “winpty” before the “docker …” command. It works on GitBash, Putty and MobaXTerm.

get-login is deprecated, so it makes sense to avoid it.

I’m still having trouble figuring out how to use its replacement, get-login-password, without getting “Cannot perform an interactive login from a non TTY device”.

I got this working in github actions without the “non TTY device” message.

It’s not an ideal solution as the password is used inline but it works. If you are running it in the makefile you can prepend @ to hide the whole command to be printed

docker login --username AWS --password $(aws ecr get-login-password --region eu-central-1) account.dkr.ecr.eu-central-1.amazonaws.com

Same error here $(aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin account.dkr.ecr.eu-central-1.amazonaws.com)

I am getting the same error for:aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin account.dkr.ecr.us-east-1.amazonaws.com/myrepo

aws --version aws-cli/2.0.8 Python/3.7.4 Darwin/19.3.0 botocore/2.0.0dev12

@jamiejackson I am having the same problem. Have tried:

login-to-aws:
	aws ecr get-login-password --region ${REGION_NAME} \
	| docker login --username AWS --password-stdin \
        ${AWS_ACCOUNT_ID}.dkr.ecr.${REGION_NAME}.amazonaws.com

error: “Cannot perform an interactive login from a non TTY device”

PASSWORD=$(shell aws ecr get-login-password --region ${REGION_NAME})
login-to-aws:
        docker login --username AWS --password ${PASSWORD} \
        ${AWS_ACCOUNT_ID}.dkr.ecr.${REGION_NAME}.amazonaws.com

error: “Using --password via the CLI is insecure. Use --password-stdin.”

ECR_LOGIN = $(shell aws ecr get-login-password --region ${REGION_NAME} \
  		| docker login --username AWS --password-stdin \
                ${AWS_ACCOUNT_ID}.dkr.ecr.${REGION_NAME}.amazonaws.com)
login-to-aws:
        @$(ECR_LOGIN)

error: “Cannot perform an interactive login from a non TTY device”

My config: aws --version aws-cli/2.0.5 Python/3.7.4 Darwin/19.3.0 botocore/2.0.0dev9

There are multiple ways to login as:

Use the command below to login to ecr: $(aws ecr get-login --no-include-email --region ap-southeast-1) For above command, make sure you already configure your aws profile, here’s the guide to configure aws profile https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html

If you want to use command like below: aws ecr get-login-password | docker login --username AWS --password-stdin aws-account.dkr.ecr.aws-region.amazonaws.com/repository try to upgrade the aws cli