容器退出后关闭 Google Compute 实例

dap*_*hez 6 google-compute-engine google-cloud-platform

我正在尝试在 Compute Engine 虚拟机上部署容器(使用参数create-with-container)。

容器运行单个长时间运行的任务并退出。容器退出时如何关闭虚拟机?

[编辑:工作负载是用 Java 实现的,并且是内存密集型的,因此选择 Compute Engine 而不是 App Engine 或 Cloud Functions 等托管服务]

Mat*_*man 0

要么使用Cloud Functions处理此类工作负载,要么使用 App Engine 任务队列通过Cron for Python 安排任务,或者利用Cloud Scheduler,它可以运行定义启动和终止 VM 逻辑的 bash 脚本。我确信使用其中之一就可以解决您的用例。我首先会选择云功能。