0

How can I launch a compute instance and deploy a container on it? I can see that there is a python operator but to my understanding that will run the script in a pre-made container on the Airflow workers rather than on an external instance.

JY2k
  • 2,879
  • 1
  • 31
  • 60

1 Answers1

1

I used bash operator in order to create a compute instance with a VM.

create_compute_instance = bash_operator.BashOperator(
    task_id='create_compute',
    bash_command='gcloud beta compute instances create-with-container airflow-vm --zone us-central1-a \
 --container-image gcr.io/cloud-marketplace/google/nginx1:1.12')

Running container on VM

JY2k
  • 2,879
  • 1
  • 31
  • 60