gpt4 book ai didi

laravel - 无法在Google Compute Engine上部署容器镜像

转载 作者:行者123 更新时间:2023-12-02 19:52:46 25 4
gpt4 key购买 nike

我正在尝试使用cloudbuild.yaml在Compute Engine上部署容器镜像,但出现错误。以下是我的cloudbuild.yaml文件的内容:

# gis-account-manager -> Project ID on GCP
steps:
# Build the Docker image.
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/gis-account-manager/ams', '-f', 'Dockerfile', '.']

# Push it to GCR.
- name: gcr.io/cloud-builders/docker
args: ['push', 'gcr.io/gis-account-manager/ams']

# Deploy to Prod env (THIS STEP IS FAILING)
- name: gcr.io/cloud-builders/gcloud
args: [ 'compute', 'instances', 'update-container', 'instance-2-production' , '--container-image', 'gcr.io/gis-account-manager/ams:latest']

# Set the Docker image in Cloud Build
images: ['gcr.io/gis-account-manager/ams']

# Build timeout
timeout: '3600s'
错误:

Starting Step #2

Step #2: Already have image (with digest): gcr.io/cloud-builders/gcloud

Step #2: ERROR: (gcloud.compute.instances.update-container) Underspecified resource [instance-2-production]. Specify the [--zone] flag.


如果我从Cloud SDK Sheel运行相同的命令,它将按预期工作。
PS:我也尝试过提供ZONE标志。

最佳答案

您需要在gcloud compute命令中指定区域:

# Deploy to Prod env (THIS STEP IS FAILING)
- name: gcr.io/cloud-builders/gcloud
args: [ 'config', 'set', 'compute/zone', 'us-central1-a']
- name: gcr.io/cloud-builders/gcloud
args: [ 'compute', 'instances', 'update-container', 'instance-2-production' , '--container-image', 'gcr.io/gis-account-manager/ams:latest']

您需要通过 zone from this list更改asia-east1。并且由于您正在更新容器,因此可能已经指定了区域。

您可以编写命令: gcloud compute zones list列出所有可用区域

关于laravel - 无法在Google Compute Engine上部署容器镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59468443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com