【发布时间】:2018-04-08 16:09:18
【问题描述】:
我正在使用 Google Container Builder 构建图像并将它们推送到 gcr.io
构建完成后如何在 CoreOS 虚拟机上触发拉取/运行? (我无法使用 Google Container Engine)
【问题讨论】:
标签: google-cloud-platform google-compute-engine google-container-builder
我正在使用 Google Container Builder 构建图像并将它们推送到 gcr.io
构建完成后如何在 CoreOS 虚拟机上触发拉取/运行? (我无法使用 Google Container Engine)
【问题讨论】:
标签: google-cloud-platform google-compute-engine google-container-builder
如果您在 Cloud Shell 中构建容器,并且需要在您的 CoreOS 虚拟机上拉取并运行镜像,您可以使用以下命令作为基础来实现此目的。这假定您正在使用配置文件来指示 Container Builder 根据您的规范执行任务,并且您与 Dockerfile 位于同一目录中(类似于here 概述的方法):
gcloud container builds submit --config cloudbuild.yaml . && gcloud compute ssh INSTANCE_NAME -- 'docker run -d gcr.io/PROJECT-ID/IMAGE:TAG'
上述命令利用 Container Builder 构建镜像并将其推送到 Container Registry。该命令完成构建和推送后,它会访问实例并执行 docker run 命令以自动运行现在存储在 Container Registry 中的映像。该命令在完成后会自动退出远程实例。
【讨论】: