Herokudocker部署

我正在关注这篇文章https://devcenter.heroku.com/articles/container-registry-and-runtime ,我卡在“heroku容器:推”。 我运行“heroku容器:推–app mediabox”和docker的形象是正确的build立,然后开始把它推到registry,这就是我得到:

Successfully built 7926b98d51b5 The push refers to a repository [registry.heroku.com/mediabox/web] 38d48dd6de30: Preparing 969058e6ddc9: Preparing 2f454953e0e7: Preparing f67c1ecd32a1: Preparing 44fade3982ca: Preparing 0accb1c81980: Waiting e79bbdfaa0d3: Waiting 1be5d1797b73: Waiting 5c0a4f4b3a35: Waiting 011b303988d2: Waiting error parsing HTTP 400 response body: unexpected end of JSON input: "" ! Error: docker push exited with 1 

这是我的Dockerfile:

 FROM ruby:2.3.1-alpine RUN apk --update --no-cache add build-base less libxml2-dev libxslt-dev nodejs postgresql-dev && mkdir -p /app WORKDIR /app COPY Gemfile Gemfile.lock ./ RUN gem install bundler RUN bundle COPY . ./ CMD ["script/docker-entrypoint.sh"] 

我在这里找不到解决scheme。 谢谢你的帮助。

当我忘记运行heroku container:login时,我有这个问题heroku container:login 。 即使您login到heroku,heroku容器服务也需要单独login。 这就是为什么你在上传开始时就遇到错误 – 你没有被授权。

registry.heroku.com/mediabox/web

只要使用heroku仪表板创build一个名称为“mediabox”的应用程序,然后再次尝试推送图像,这对我来说是有效的。

首先,Heroku中的Docker集成在BETA中,正如您链接的文章所说的那样。 它可能还有一些错误。 所以也许是一个好主意,直​​接联系在这个Heroku支持。

假设Heroku集成和你的代码都可以,我只能build议你停止使用heroku container:push只能使用官方的docker命令。 这可能会避免一些推动问题。

您可以使用以下方式在本地构build图像

 docker build . 

然后使用以下命令将其推送到Heroku:

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

我有使用Docker的基于Gitlab CI和Heroku的生产环境。 我们所有的整合只依赖于docker命令,而且我们从来没有遇到任何推送本地构build的图像的问题。

我需要明确地通过应用程序名称,而不是内部的那么做heroku container:push --app rocky-wildwood-86034进展顺利。

我做了:heroku容器:推–app mediabox

正确的一个是:heroku容器:推–app的rocky-wildwood-86034

简单的应用程序名称应该是全局heroku应用程序名称,而不是在docker-compose.yml中定义的名称。

当我忘记了heroku container:login时,我有同样的错误heroku container:login首先heroku container:login 。 不确定您的问题是否由相同的用户错误引起的。