As per
this article "--source-instance" flag to save the configuration of an existing virtual machine instance into an instance template. From your gcloud command line, it seems like you already used this flag but still the new instances created without the code from existing instance, In order move the case forward and figure out the root cause please provide the following information:
- Is there more than one disk on the machine? we need this information because, this manifests easily if code lives on a second disk, but the template is made only from the boot disk.
- Can you create the template successfully via cloud console? Flow would be to
1) Make an image from the intended disk
2) make a new instance template from that image (once you create image you will see the image under "Custom images" )
3) spin up instance using that template