0

So, I mounted a GCS Bucket on my VM using the gcsfuse --implicit-dirs [bucket] [mount-point] command.
I'm using the same [mount-point] with docker to persist my data. However, when I start my containers with docker-compose up I'm getting an error saying mkdir file exists

I got it to work after unmounting the bucket and mounting it again with gcsfuse --implicit-dirs -o allow_others [bucket] [mount-point]. However, I read that it is not safe to use the -o allow_others flag.

How am I supposed to make it work without using this flag?

Dragotic
  • 193
  • 1
  • 1
  • 7

2 Answers2

0

According to this link, the flag -o allow_others is needed. There are several example articles here and here.

Here, they also use the -o allow_others flag. It is the same error while using the same mount point, although they are not using GCS buckets. They reproduced your issue. You need to pass -o allow_other when you mount. Otherwise mount can only be used by your current user. Docker daemon runs as root, not as your regular user, so it can't access the files. Sudo is not required on mount if your user has permissions to mount. Please See this.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • I'm not able to mkdir or touch inside the container, even though I included the ```allow_other``` flag. – Dragotic Jul 13 '18 at 14:02
  • Thanks for your response. Can you let me know which of the documents I posted you used ? Also, in order to reproduce the question, you can let me know more details about your container images. – mehdi sharifi Jul 14 '18 at 00:36
  • I tried all the links but not a single one helped. I have two docker containers one with a simple nginx that reverse proxies traffic to a php-fpm 7.2.2 image that's a essentially a Laravel application. – Dragotic Jul 19 '18 at 14:00
0

I tried to do the same thing and encountered a ton of gotchas. I wrote a tutorial that explains end-to-end how to mount a GCS bucket on GCE from within a Docker container:

mtlynch
  • 3,403
  • 4
  • 31
  • 31