在google云平台上构建VM实例的错误,因为找不到现有镜像

问题描述 投票:0回答:1

我想从云外壳在谷歌云平台上创建一个 VM 实例。

  gcloud compute --project "MY_PROJECT" instance create "test-instance" --zone "us-central1-f" --machine-type "n1-standard-1" --network "defailt" --maintain-policy "MIGRATE" --scope ["https://www.googelapis.com/auth/devstorage.full_control"] --service-account "MY_ACCOUNT" --image "MY_IMAGE@digest" --image-project MY_PROJECT --boot-disk-size "100" --boot-disk-type "pd-standard" --boot-disk-device-name "test-instance"

我得到错误:

 gcloud.compute.instance.create could not fetch resource: 
 - invalid value for field 'resource.disks[0].initializeParams.sourceIamge':'https://compute.gogoleapis.com/compute/v1/projects/MY_PROJETC/global/images/MY_IMAGE@digest'. the URL is malformed.

但是,我用过:

gcloud compute images list --uri # it cannot find the image

如果我使用:

 gcloud container images list # it can show it !

如何让“gcloud compute”找到我的图像?谢谢

google-cloud-platform google-compute-engine
1个回答
0
投票

--image
用于为实例指定 boot image 或其 OS Image 而不是 Container Image。您需要使用
--container-image
标志,然后指定您的容器镜像。查看此文档以供参考

因此命令

gcloud container images list
可以看到你的图像而不是
gcloud compute images list

© www.soinside.com 2019 - 2024. All rights reserved.