Bal*_*Pap 34 google-cloud-platform dockerfile nuxt.js google-cloud-run
当我尝试在 Google Cloud Run 中运行容器时收到此错误消息。
type: Ready
status: 'False'
reason: HealthCheckContainerError
message: |-
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.
Run Code Online (Sandbox Code Playgroud)
我已经检查了以下内容,但对我没有任何帮助:
我的容器在本地运行,并且正在侦听默认端口,8080
并将主机配置为0.0.0.0
。
我的 Dockerfile:
FROM node:10
WORKDIR /usr/src/app
ENV PORT 8080
ENV HOST 0.0.0.0
COPY package*.json ./
RUN npm install --only=production
COPY . .
RUN npm run build
CMD npm start
Run Code Online (Sandbox Code Playgroud)
知道为什么 Cloud Run 一直无法侦听端口吗?
项目 GitHub 存储库:
小智 150
请检查一下,您使用的是 M1 Macbook 吗?在面对这个问题一段时间后,我为自己找到了一个解决方案,可能不适合您,但只是为了与其他 MacBook 用户分享我发现的一些见解。
太长了;博士
--platform linux/amd64
在将映像部署到 Cloud Run 之前使用该标志构建 Docker 容器
=================================================== ======
很长的故事:
除了container failed to start and listen to the $PORT
错误之外,我的日志还显示以下内容:Application failed to start: Failed to create init process: failed to load /usr/local/bin/npm: exec format error
。经过一番挖掘,发生这种情况的原因之一是我们尝试在不同的主机平台上运行 arm64 映像(在 M1 MacBook 上构建)。
GCP 在此页面上确实提到了Executables in the container image must be compiled for Linux 64-bit. Cloud Run specifically supports the Linux x86_64 ABI format.
我想这解释了为什么在 Cloud Build 上构建映像可以从本文中的其他答案中得出。
归档时间: |
|
查看次数: |
30246 次 |
最近记录: |