0

I've been trying to work out how to trigger a google cloud VM using a custom docker image contained in my artifact registry.

What I have tried:

  • I can create a VM using the google cloud CLI
  • I can create a VM using the google cloud sdk in nodejs if it uses a public template, but not my custom image from the artifact registry
  • I cannot create a VM using the google cloud CLI
  • I cannot even create a VM using the google cloud CLI that the google cloud interface generates for me, running it on the google cloud shell terminal.

Here is an example CLI template that the google cloud console spits out.

gcloud compute instances create-with-container instance-1 \
    --project=<project name> \
    --zone=<zone> \
    --machine-type=e2-micro \
    --network-interface=network-tier=PREMIUM,stack-type=IPV4_ONLY,subnet=default \
    --maintenance-policy=MIGRATE \
    --provisioning-model=STANDARD \
    --service-account=<service account> \
    --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append \
    --image=projects/cos-cloud/global/images/cos-stable-105-17412-101-13 \
    --boot-disk-size=10GB \
    --boot-disk-type=pd-balanced \
    --boot-disk-device-name=instance-1 \
    --container-image=<image address> \
    --container-restart-policy=always \
    --no-shielded-secure-boot \
    --shielded-vtpm \
    --shielded-integrity-monitoring \
    --labels=goog-ec-src=vm_add-gcloud,container-vm=cos-stable-105-17412-101-13

This is unmodified from what the google cloud console produced as Equivalent code. Running it on the google cloud shell produces the error ERROR: (gcloud.compute.instances.create-with-container) argument --network-interface: valid keys are [address, aliases,...

Is there something wrong with the above CLI command and can anyone give me hints for creating a VM using a custom image from my artifact registry?

Sim
  • 1

0 Answers0