Google cloud platform (gcloud.run.deploy)云运行错误:容器无法启动。无法启动然后在端口上侦听

Google cloud platform (gcloud.run.deploy)云运行错误:容器无法启动。无法启动然后在端口上侦听,google-cloud-platform,google-cloud-run,Google Cloud Platform,Google Cloud Run,使用gcloud builds submit--tag gcr.io/projectname/testserver成功部署容器,然后尝试运行gcloud run deploy--image gcr.io/projectname/testserver--platform managed后,我发现以下错误: $ gcloud run deploy --image gcr.io/projectname/testserver --platform managed Please specify a reg

使用
gcloud builds submit--tag gcr.io/projectname/testserver
成功部署容器,然后尝试运行
gcloud run deploy--image gcr.io/projectname/testserver--platform managed
后,我发现以下错误:

$ gcloud run deploy --image gcr.io/projectname/testserver --platform managed
Please specify a region:
 // options removed

Service name (testserver):  
Allow unauthenticated invocations to [testserver] (y/N)?  y

Deploying container to Cloud Run service [testserver] in project [projectname] region [us-central1]
X Deploying new service... 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 r
evision might contain more information.    
  X Creating Revision... Cloud Run error: C
  ontainer failed to start. Failed to start
   and then listen on the port defined by t
  he PORT environment variable. Logs for th
  is revision might contain more informatio
  n.                                       
  . Routing traffic...                     
  ✓ Setting IAM Policy...                  
Deployment failed                          
ERROR: (gcloud.run.deploy) 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.

我有一个非常简单的项目,都在根文件夹中:

// Dockerfile
FROM node:12-slim

# Create app folder
WORKDIR /usr/src/app

# Install app deps. Copy the lock file
COPY package*.json ./
RUN npm install

COPY . ./
CMD ["node", "testServer.js"]

有人知道这是什么原因吗?从昨天开始就一直在尝试解决这个问题,现在即使是这个最小的项目,它似乎也有问题。

我收到了
类型错误:app.get不是代码的函数。看起来这个语法已经过时了。重写和工作刚刚好

无论如何,在部署之前,请尝试使用在本地测试代码。
此外,您还可以在控制台->日志->云运行修订->修订id

中找到部署期间更精确的错误消息,这里也有相同的错误。我解决了增加
超时

的问题,如果容器启动时记录了任何错误怎么办?您可以收集所有工件并将它们放在临时GitHub repo中并发布链接吗。也许某个善良的灵魂会尝试重新创造?谢谢,我解决了这个特殊的问题。不过,我现在有另一个问题,
docker run..
不起作用。
代表其他东西吗?@Seandezaysa更新了答案,并引用了
docker run
// testServer.js
const Koa = require("koa");
const koa = new Koa();

koa.get('/', async ctx => {
  ctx.body = "Koa server running"
});

const port = process.env.PORT || 8080;

koa.listen(port);