简体   繁体   English

Docker - 错误:无法从非 TTY 设备执行交互式登录(GCP 服务帐户)

[英]Docker - Error: Cannot perform an interactive login from a non TTY device (GCP Service Account)

The command docker login -u _json_key --password-stdin https://gcr.io < ~/service-account.json works locally, but when I try to run it in a CI environment like Github Actions, I get the following error. The command docker login -u _json_key --password-stdin https://gcr.io < ~/service-account.json works locally, but when I try to run it in a CI environment like Github Actions, I get the following error .

Error: Cannot perform an interactive login from a non TTY device错误:无法从非 TTY 设备执行交互式登录

##[error]Process completed with exit code 1. ##[错误]进程完成,退出代码为 1。

The oauth2accesstoken authentication strategy worked for me. oauth2accesstoken身份验证策略对我有用。

  1. Login to gcloud cli using service account使用服务帐号登录gcloud cli

gcloud auth activate-service-account --key-file=${HOME}/service-account.json

  1. Print access token and use it to log into docker打印访问令牌并使用它登录 docker

gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://gcr.io

It seems you are impersonating a service account with an authentication token to login docker.您似乎正在使用身份验证令牌模拟服务帐户来登录 docker。 You can obtain an access token for the service account.您可以获得服务帐户的访问令牌。 Since the token is short-lived, request it less than an hour before you use it to connect with the Container Registry.由于令牌是短暂的,请在使用它连接 Container Registry 前不到一小时请求它。

The steps are documented here .这些步骤记录在这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 gitlab-ci Docker login Heroku 报错:无法从非TTY设备执行交互式登录 - Gitlab-ci Docker login Heroku Error: Cannot perform an interactive login from a non TTY device 从 Github 登录到 Docker 时无法从非 TTY 设备执行交互式登录? - Cannot perform an interactive login from a non TTY device when login from Github to Docker? 无法从非 TTY 设备执行交互式登录 - Cannot perform an interactive login from a non TTY device 尝试将 Docker 连接到 ECS 存储库时无法从非 TTY 设备执行交互式登录 - Cannot perform an interactive login from a non TTY device while trying to connect Docker to ECS repository 从 Gitlab CI 登录 Google Cloud Registry 时出错:无法从非 TTY 设备执行交互式登录 - Error logging in to Google Cloud Registry from Gitlab CI: Cannot perform interactive login from a non TTY device 无法从 garygrossgarten/github-action-ssh@release 的非 TTY 设备错误执行交互式登录 - Cannot perform an interactive login from a non TTY device error from garygrossgarten/github-action-ssh@release 从“Amazon Container Services”复制 cmd 后,aws ecr 说“无法从非 TTY 设备执行交互式登录” - aws ecr saying "Cannot perform an interactive login from a non TTY device" after copied cmd from "Amazon Container Services" Gitlab-runner 本地构建 - 从非 TTY 设备登录 - Gitlab-runner local build - login from non TTY device docker exec -it返回“无法在非tty输入上启用tty模式” - docker exec -it returns “cannot enable tty mode on non tty input” 输入设备不是 Jenkinsfile 中的 TTY 错误,带有 docker 命令 - The input device is not a TTY error in Jenkinsfile with docker commands
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM