Reputation: 148
I have a small issue. So I have built docker images that I need to be running on Google Cloud, and my issue is that running them requires two volume binding flags. And I can't seem to figure it out how they are passed as container arguments inside Cloud Run in the Google Cloud console. This is the command if I were to run the docker image locally:
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp --gpus all -it --rm --name ner -p 5000:5000 electra_mlflow
Excuse me for the line being long, but the only thing from it that matters are the two volume binding arguments. I've read the documentation for Google Cloud and I couldn't figure it out. Then I ran into this blog that states that Google Cloud doesn't allow volumes, but proposes a workaround using Secret Manager. https://medium.com/google-cloud/mount-a-file-as-a-volume-in-cloud-run-facc74c02cc6
I'm however nowhere nearer how I would use this workaround for my application, specifically: what string would I save in secrets for this to work? Also, as I understand it, there's a file size limit to the workaround which is a problem, but a solvable one for me.
Upvotes: 1
Views: 2406
Reputation: 40136
Cloud Run is a so-called "serverless" platform and you do not have access to the underlying host running the container(s).
For this reason, there's no equivalent of volume-mounting the host's directories into the container as is achieved with Docker when running docker run
with --volumes
.
There are various ways that your Cloud Run service could access e.g. external files. Using a Secret Manager is one way though this approach is generally most applicable to the use of secrets.
If you want a Cloud Run service to be able to access files as if these were on a local e.g. Linux machine, you may want to evaluate NFS server solutions. These enable your Cloud Run instances to operate is if the files were available locally as you achieve with docker run ... --volumes=...
.
See:
I encourage you to research the options thoroughly and be mindful of alternative (!) ways to achieve these results.
For example, you could:
/tmp
directory contents into the imageUpvotes: 3