为什么 Google Compute Engine 没有运行我的容器? [英] Why is Google Compute Engine not running my container?

查看:25
本文介绍了为什么 Google Compute Engine 没有运行我的容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以成功:

  • 将我的应用程序捆绑到 docker 映像中
  • 在推送到 master 时使用 Google Cloud Build 将此映像构建到容器中
    • (此容器存储在注册表中,例如 gcr.io/my-project/my-container)

    我现在正在尝试更复杂的构建,我认为下一步是使用 Google Compute Engine.

    I am now trying more sophisticated builds and I think the next step is to use Google Compute Engine.

    首先,我只是尝试部署我部署到 Cloud Run 的同一应用的单个实例:

    To start, I am simply trying to deploy a single instance of the same app that I deployed to Cloud Run:

    • 导航到 Compute Engine >虚拟机实例
    • 输入实例名称等基本信息
    • 在Container Image"下输入我的容器位置:gcr.io/my-project/my-container
      • (顺便说一句,我怀疑该界面没有为您现有的 Container Registry 项目提供选择器.)

      GCE 创建它需要一分钟,然后它会显示绿色复选标记和实例名称,以及外部 IP:35.238.xxx.xxx".我在浏览器中访问该 URL 并得到...35.238.xxx.xxx 拒绝连接."

      GCE takes a minute to create it, and then it shows the green checkmark and the instance name, and "External IP: 35.238.xxx.xxx". I visit that URL in my browser and get... "35.238.xxx.xxx refused to connect."

      为了检查,我返回 GCE 页面并选择我的实例旁边的SSH > 在浏览器窗口中打开",这会向机器打开一种云终端.

      To inspect, I go back to the GCE page and select "SSH > Open in browser window" next to my instance, which opens a type of cloud terminal to the machine.

      在此终端窗口中,键入 ps 并查看没有进程正在运行.容器 DockerfileCMD yarn start:prod 结尾,所以我猜这不会发生在这里.

      In this terminal window, type ps and see that no processes are running. The container Dockerfile ends with CMD yarn start:prod, so I guess that's not happening here.

      此外,我 ls 在这里和那里导航,并看到我的 Dockerfile/app 目录中没有 /app 目录code>WORKDIR/app 命令.似乎不仅我的应用没有启动,而且容器没有复制到 VM 实例中?

      Further, I ls here and there and navigate around, and see that there is no /app directory from my Dockerfile's WORKDIR /app command. It seems like not only did my app not boot, but was the container not copied to the VM instance?

      我做错了什么?

      推荐答案

      对于遇到此问题的任何人.我遇到了同样的问题,无法弄清楚.

      For anyone having this issue. I faced the same problem and couldn't figure it out.

      阅读 Serhii 的回答给了我线索.我相信截至今天(2021 年 1 月),GCP Console UI 有点无用.看起来,如果您在创建 VM 时输入容器名称但 WITHOUT 在末尾指定一个标签,它不会抱怨也不会假设默认值,例如最新",它只是默默地失败.因此,VM 但没有运行 docker 容器.

      Reading Serhii's answer give me the clue. I believe as of today (Jan 2021) the GCP Console UI is a bit unhelpful. It appears that if you type in a container name when creating your VM but WITHOUT specifying a tag on the end, it doesn't complain nor assume a default such as 'latest', it just fails silently. Hence the VM but with no docker container running.

      至少它现在对我有用,希望这可以帮助其他人.

      At least it this now works for me, hopefully this helps others.

      这篇关于为什么 Google Compute Engine 没有运行我的容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆