title: Pushing Docker images from Kubernetes Pod Operator in Airflow cloud composer
body: <p>I am trying to push an image to GCR using KubernetesPodOperator but I keep getting this error: <code>unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication\n</code></p>
  <p>My hypothesis is that the default service-account that kubernetes pod operator uses does not have the permission to push images to GCR. Here is the code that I use:</p>
  <pre><code>KubernetesPodOperator(
         task_id=f&quot;push_image_to_gcr&quot;,
         name=f&quot;push-image&quot;,
         ## push_to_gcr.py is a python script that tries to push the image to GCR using subprocess library
         cmds=[&quot;python&quot;, &quot;push_to_gcr.py&quot;],
         namespace=&quot;default&quot;,
         ## the image I pass in here has docker installed in it which allows me to run docker commands
         image=&quot;gcr.io/project-id/image&quot;
  )
  </code></pre>
  <p>I tried to pass in my service-account JSON file by storing the JSON under variable in Airflow UI (<code>env_vars={'GOOGLE_APPLICATION_CREDENTIALS': '{{ var.value.my_gcp_account }}}'}</code>), but still could not push the image.</p>
  <p>Any help would be appreciated.</p>