0

I'm using Cloud Build to start a Google Cloud Compute Engine VM.

Here's the command I got from Compute Engine by selecting options in the UI and getting the "Equivalent command line", notice the --enable-display-device:

gcloud compute instances create-with-container my-vm 
--project=XXX
--zone=us-central1-a 
--machine-type=g1-small 
--network-interface=network-tier=PREMIUM,subnet=default 
--maintenance-policy=MIGRATE 
--provisioning-model=STANDARD 
--service-account=XXX 
--scopes=https://www.googleapis.com/auth/cloud-platform 
--enable-display-device 
--image=projects/cos-cloud/global/images/cos-stable-97-16919-29-16 
--boot-disk-size=10GB 
--boot-disk-type=pd-balanced 
--boot-disk-device-name=checkmate-dev 
--container-image=XXX 
--container-restart-policy=always 
--no-shielded-secure-boot 
--shielded-vtpm 
--shielded-integrity-monitoring 
--labels=container-vm=cos-stable-97-16919-29-16

This command is placed in the args field of the cloudbuild.yaml which seems to run as intended until Cloud Build spits out an error:

unrecognized arguments: --enable-display-device (did you mean '--boot-disk-device-name'?) 

I don't understand because this flag came from Compute Engine so I figure it's valid. The flag is not actually in the docs in https://cloud.google.com/sdk/gcloud/reference/compute/instances/create-with-container.

But if I use the Compute Engine UI to make a "New VM Instance" as opposed to a container VM, then the flag appears in the command line.

engineer-x
  • 2,173
  • 2
  • 12
  • 25
  • 1
    Why do you want to enable a display device? COS does not include software to display a desktop interface. That would defeat the security model that COS tries to maintain. – John Hanley Dec 11 '22 at 08:46
  • 1
    Great question. I ask because I'm running a Selenium web driver on the container and when I've started on a non-COS VM, I've always marked the Display Device option. But I just now tested without the Display Device flag on the COS and my Selenium web driver works as intended! Thank you! – engineer-x Dec 13 '22 at 06:52

0 Answers0