Search code examples
dockergoogle-cloud-platformgpugoogle-compute-enginegcloud

GCloud: Creating instance template with docker container and GPU


Using gcloud, I want to create an instance template of type n1-standard-1 with an attached GPU and a docker container. This can be done through the console but I want to do it from the command line.

It is possible to create an instance template with GPU using gcloud alpha compute instance-templates create and the --accelerator option.

It is also possible to create an instance template with a container using gcloud alpha compute instance-templates create-with-container but in this case the --accelerator option is not recognized.

... but it is not possible to both specify the container image and request GPU or am I missing something ? Any work-around beside creating the template manualy using the console ?


Solution

  • It is possible to create an instance with accelerators and a container with gcloud by creating the instance with accelerators and then using gcloud beta compute instances update-container to set the container, but it is not currently possible to create an instance template with accelerators and a container with gcloud.

    You can file a feature request for that functionality at: https://issuetracker.google.com/issues/new?component=187143&template=0