<p>I need to run a docker container when a Cloud function is triggered. Also, I need this Docker to mount a folder from an NFS file server VM that is running in a Google Cloud Compute Engine. </p>

<ul>
<li><p>How can I run a docker container from a Firebase/Cloud Function?</p></li>
<li><p>If it is not possible, can I trigger a docker container hosted in Kubernetes from one of these functions and how?</p></li>
</ul>

Ruben A. Chevez
<p>What you describe sounds like an ideal story for the Google product called <a href="https://cloud.google.com/run/" rel="nofollow noreferrer">Cloud Run</a>.  In summary and at the highest level ... Cloud Run lets you run a docker container on demand when an incoming REST request arrives.  You are billed for only the duration of execution of your container.  When there is no traffic/requests, the container is automatically spun down and you are no longer charged.  You can control how many requests are served per container (1 request = 1 container or multiple requests served by the same container or any combinations).</p>

<p>Effectively, Cloud Run is an alternative to Cloud Functions.  With Cloud Functions you provide the function body and Cloud Functions provides the environment in which it runs.  With Cloud Run, you provide the container which provides the function implementation AND the environment in which it runs.  In both cases, Google owns the startup, shutdown and other management of the environment including scaling.</p>

<p>Google on the phrase "GCP Cloud Run" and you will find a wealth of documentation.  I strongly suggest that this be your first research area given your described requirement.   Please feel free to post additional questions tagged with google-cloud-run if you need further elaboration.  If Cloud Run isn't a good answer to your question, please also post back so that we may all understand better.</p>
