问题
My final goal is to mount a bucket inside a container to be deployed with google run.
In order to mount a bucket, I am using gcsfuse that requires a privileged container. (https://github.com/maciekrb/gcs-fuse-sample et.al...)
With a VirtualMachine I would use:
gcloud compute instances create-with-container \
[...] \
--container-privileged
While with google run:
gcloud beta run deploy [...]
But it doesn't seem to have this option.
Any hint will be appreciated.
回答1:
My final goal is to mount a bucket inside a container to be deployed with google run.
What you are trying to do is not supported by Cloud Run.
Cloud Run has a few rules (and a few more):
- The container runs beginning with the first HTTP request to it.
- The container is eligible to be terminated after the last HTTP Request returns.
- Cloud Run containers are stateless.
- Cloud Run does not support background processes.
To use gcs-fuse in Cloud Run would require creating TCP connection that run independently of the state of the container. When Cloud Run puts the container to sleep your connections will fail.
回答2:
That is something you cannot do with Google Run product. Instead, you need to use Google App Engine Flex, which does not have timeout like Google App Engine or Google Cloud Functions. And also you should use Google Storage blob access functions to access files.
来源:https://stackoverflow.com/questions/56997955/how-to-mount-a-bucket-in-a-google-run-application