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

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

问题描述

我可以成功做到这一点:

I can do this successfully:

  • 将我的应用捆绑到docker映像中
  • 在推送至主服务器后,使用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>虚拟机实例
    • 输入实例名称之类的基础知识
    • 在容器映像"下输入我的容器位置: 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 并看到没有进程在运行.容器 Dockerfile CMD 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 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控制台用户界面仍无济于事.看来,如果您在创建VM时输入了容器名称,但 WITHOUT 最后指定了一个标签,则它不会抱怨也不会采用默认值(例如"latest"),只会默默地失败.因此是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天全站免登陆