如何使用Docker映像在Heroku上部署Asp.net Core 2.2应用程序并避免Dockerfile错误

时间:2019-04-10 12:12:39

标签: docker heroku asp.net-core docker-compose dockerfile

我正在docker镜像中构建一个asp.net core 2.2应用程序以将其托管在Heroku中,但我不知道dockerfile的确切配置是什么,我使用了Dockerfile的示例,但打开后却出现此错误在heroku上的应用程序:

应用程序错误:应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查日志以获取详细信息。您可以使用以下命令在Heroku CLI中执行以下操作:heroku logs --tail

这是日志文件:

2019-04-10T02:51:45.024996+00:00 heroku[web.1]: State changed from crashed to starting 2019-04-10T02:51:52.077699+00:00 heroku[web.1]: Starting process with command /bin/sh -c ASPNETCORE_URLS\=http://\*:\58395\ dotnet\ sitehidamek.dll 2019-04-10T02:51:53.841749+00:00 heroku[web.1]: State changed from starting to crashed 2019-04-10T02:51:53.820061+00:00 heroku[web.1]: Process exited with status 145 2019-04-10T02:51:53.715427+00:00 app[web.1]: Did you mean to run dotnet SDK commands? Please install dotnet SDK from: 2019-04-10T02:51:53.715458+00:00 app[web.1]: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 2019-04-10T03:34:20.255335+00:00 heroku[web.1]: State changed from crashed to starting 2019-04-10T03:34:26.731799+00:00 heroku[web.1]: Starting process with command /bin/sh -c ASPNETCORE_URLS\=http://\*:\41495\ dotnet\ sitehidamek.dll 2019-04-10T03:34:28.273366+00:00 heroku[web.1]: State changed from starting to crashed 2019-04-10T03:34:28.245573+00:00 heroku[web.1]: Process exited with status 145 2019-04-10T03:34:28.208525+00:00 app[web.1]: Did you mean to run dotnet SDK commands? Please install dotnet SDK from: 2019-04-10T03:34:28.208542+00:00 app[web.1]: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 2019-04-10T04:57:22.211933+00:00 heroku[web.1]: State changed from crashed to starting 2019-04-10T04:57:28.788242+00:00 heroku[web.1]: Starting process with command /bin/sh -c ASPNETCORE_URLS\=http://\*:\5818\ dotnet\ sitehidamek.dll 2019-04-10T04:57:30.339475+00:00 heroku[web.1]: State changed from starting to crashed 2019-04-10T04:57:30.315137+00:00 heroku[web.1]: Process exited with status 145 2019-04-10T04:57:30.260093+00:00 app[web.1]: Did you mean to run dotnet SDK commands? Please install dotnet SDK from: 2019-04-10T04:57:30.260116+00:00 app[web.1]: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 2019-04-10T07:38:35.071679+00:00 heroku[web.1]: State changed from crashed to starting 2019-04-10T07:38:42.362172+00:00 heroku[web.1]: Starting process with command /bin/sh -c ASPNETCORE_URLS\=http://\*:\30695\ dotnet\ sitehidamek.dll 2019-04-10T07:38:43.942597+00:00 heroku[web.1]: State changed from starting to crashed 2019-04-10T07:38:43.928214+00:00 heroku[web.1]: Process exited with status 145 2019-04-10T07:38:43.874881+00:00 app[web.1]: Did you mean to run dotnet SDK commands? Please install dotnet SDK from: 2019-04-10T07:38:43.874911+00:00 app[web.1]: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 2019-04-10T12:01:49.430309+00:00 app[api]: Deployed web (a1ffce692888) by user javator.developper@gmail.com 2019-04-10T12:01:53.388766+00:00 heroku[web.1]: State changed from crashed to starting 2019-04-10T12:01:49.430309+00:00 app[api]: Release v9 created by user javator.developper@gmail.com 2019-04-10T12:01:59.449423+00:00 heroku[web.1]: Starting process with command /bin/sh -c ASPNETCORE_URLS\=http://\*:\29461\ dotnet\ sitehidamek.dll 2019-04-10T12:02:02.125769+00:00 heroku[web.1]: State changed from starting to crashed 2019-04-10T12:02:02.200130+00:00 heroku[web.1]: State changed from crashed to starting 2019-04-10T12:02:02.100437+00:00 heroku[web.1]: Process exited with status 145 2019-04-10T12:02:02.027670+00:00 app[web.1]: Did you mean to run dotnet SDK commands? Please install dotnet SDK from: 2019-04-10T12:02:02.027705+00:00 app[web.1]: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 2019-04-10T12:02:06.637725+00:00 heroku[web.1]: Starting process with command /bin/sh -c ASPNETCORE_URLS\=http://\*:\26871\ dotnet\ sitehidamek.dll 2019-04-10T12:02:08.966532+00:00 heroku[web.1]: State changed from starting to crashed 2019-04-10T12:02:08.947251+00:00 heroku[web.1]: Process exited with status 145 2019-04-10T12:02:08.904559+00:00 app[web.1]: Did you mean to run dotnet SDK commands? Please install dotnet SDK from: 2019-04-10T12:02:08.904574+00:00 app[web.1]: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

Dockerfile的内容为:

从microsoft / aspnetcore:2.0

WORKDIR / app

复制。

CMD ASPNETCORE_URLS = http:// *:$ PORT dotnet sitehidamek.dll

有什么建议吗?

我正在使用Visual Studio代码(Mac os)。

0 个答案:

没有答案