I currently have a docker container on the gcloud container repository which I want to launch an instance of in order to run a calculation, save a result and close:
gcloud compute instances create-with-container test-1 \
--machine-type=n1-standard-4 \
--boot-disk-size=20GB \
--container-image=eu.gcr.io/<container-link> \
--container-env=GCLOUD_INPUT_FILENAME=file.txt \
--container-env=GCLOUD_PROJECT=project-name
However, I want to be able to launch these instances using a web-interface (flask) which implies I want to use the googleapiclient (python) in order to create and manage these instances:
It looks like while you can create a instance creation order using the discovery api:
compute = googleclientapi.discovery.build('compute', 'v1')
compute.instances().insert(...).execute()
but it doesn't look like it is possible to emulate create-with-container
gcloud sdk command, although you can pass 'machineImage' as part of the creation request.
Can one create a compute instance 'with-container' without using subprocess
to call the gcloud sdk
OR
Can I convert my create-with-container
instance into a machine image and then use the googleapi client
?