Heroku:docker部署引发未经授权:需要身份验证

时间:2020-08-11 23:12:42

标签: docker heroku

我正在尝试使用以下步骤将简单的Flask服务器部署到Heroku:

heroku login
heroku container:login

# create the app
heroku create myapp-name-2

# create the container with format:
# docker build -t registry.heroku.com/<app name>/<process type> .
docker build -t registry.heroku.com/myapp-name-2/web .

# push the image to the registry
docker push registry.heroku.com/myapp-name-2/web

# "release" the image
heroku container:release --app myapp-name-2 web

# open the app
heroku open --app myapp-name-2

但是,docker push步骤显示:

The push refers to repository [registry.heroku.com/myapp-name-2/web]
f60f7a4e2b2a: Preparing
3ff8a98d192e: Preparing
71476851914e: Preparing
013688a141bb: Preparing
f09460ef2908: Preparing
e188a7526d55: Waiting
6b0d56603c0c: Waiting
9496e71377c6: Waiting
5710e17ef032: Waiting
9546672d6b2f: Waiting
f2c194ac8a61: Waiting
2a50ea4f9e8e: Waiting
634249d50b9e: Waiting
68e35493907b: Waiting
e84b9d651af1: Waiting
unauthorized: authentication required

有人知道我应该如何认证吗?我已经多次执行heroku loginheroku container:login步骤,但一定缺少一些东西!

3 个答案:

答案 0 :(得分:2)

是的,正如原始答案指出的第一次运行

heroku container:login

还要确保使用以下命名约定正确标记 docker 镜像:

docker tag <image> registry.heroku.com/<app>/<process-type>

<app> 应该与您在 Heroku 仪表板中的应用名称完全匹配。

附加信息:https://devcenter.heroku.com/articles/container-registry-and-runtime#pushing-an-existing-image

答案 1 :(得分:0)

我遇到了同样的错误。我只是在下面运行了命令,它就起作用了。

heroku container:login

答案 2 :(得分:0)

docker hub 登录前

heroku 容器:登录

和 heroku 容器:push web --app app_name

heroku 容器:发布 web --app app_name

为我工作