从命令行登录到 heroku docker 注册表

cho*_*ban 5 heroku docker

我正在尝试登录到 registory.heroku.com 以便我可以推送我自己的图像,但是我遇到了身份验证问题。如果我遵循docs指导,我会得到这个:

> docker login --username=_ --password=(heroku auth:token) registry.heroku.com                                                          2077ms ? Thu 29 Oct 09:15:57 2020
 ›   Warning: token will expire 05/07/2021
 ›   Use heroku authorizations:create to generate a long-term token
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
Run Code Online (Sandbox Code Playgroud)

所以它要我使用长期令牌。如果我使用 生成一个heroku authorization:create,并使用生成的令牌作为密码,则登录将被拒绝:

) docker login --username=_ --password="this is a token" registry.heroku.com                                       1140ms ? Thu 29 Oct 09:21:23 2020
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: login attempt to https://registry.heroku.com/v2/ failed with status: 401 Unauthorized
Run Code Online (Sandbox Code Playgroud)

我是否需要在长期令牌上设置范围才能使其发挥作用?我想使用长期令牌,因为该进程将在 CI 上运行,并且我想通过环境变量对其进行配置。

Oma*_*neh 3

我遇到了同样的问题,结果我使用的是令牌的 id,而不是实际的令牌,使用 herokuauthorizations:info <token_id>来获取令牌。