google-cloud-platformgoogle-cloud-storagegcsfuse

Install gcsfuse in Google Cloud Container Optimized OS (COS)


Does anyone know how do I install gcsfuse into a Google Container Optimized OS so that I could mount bucket in the VM instance itself.

I tried running a docker with gcsfuse mounted volume from host. The docker container successfully mounted the bucket into the host volume. When I view from the host volume, it is empty, but the container has the bucket data.

docker run --privileged -v /mnt/disks/bucket:/bucket \
  --device /dev/fuse \
  my_gcsfuse /go/bin/gcsfuse -o allow_other <BUCKET> /bucket
2020/12/16 23:27:21.161246 Initializing GCS connection.
2020/12/16 23:27:21.169616 File system has been successfully mounted.

From the container, I can see all files belong to gcs bucket files but not the host even I mounted the volume from host into the container.


Solution

  • The issue explained on this git, the docker-default apparmor profile denies all mounts. This '--security-opt apparmor=unconfined' flag make it possible to mount a GCS bucket.