【发布时间】:2022-01-12 20:01:18
【问题描述】:
我知道有manypostsaboutthis,但我仍然无法解决这个问题。这是一个使用 React 的 .Net Core 3.1 应用程序。
npm run build 成功完成。
我的 .env 文件中有 PORT=8080
我的 Dockerfile 设置为公开 8080:
但我仍然得到以下信息:
Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.
我已经检查了日志,但它只显示了相同的消息,并带有指向自身的链接:
所以日志看起来毫无用处。
我的部署如下:
-
docker build -f foobarDataViz.UI\Dockerfile --force-rm -t foobardataviz.ui . --no-cache这会成功构建。 -
docker run -d -p 8080:80 --name foobar foobardataviz.ui这样运行成功,可以在8080端口本地浏览 docker push us-central1-docker.pkg.dev/foobar-poc/foobar/foobardataviz.ui:latest- 然后我去 Cloud Run 并点击“Edit and Deploy New Revision”,它做了一些处理,但失败并出现上述错误
因此,错误表明它没有暴露端口,或者它只是无法完全启动。会不会是我的 docker 镜像与我设置 Cloud Run 的方式不兼容?
提前致谢
【问题讨论】:
标签: docker google-cloud-platform dockerfile google-cloud-run google-artifact-registry