Gcsfuse gives an I / O error when reading or writing to a mounted directory in docker

I use gcsfuse in the docker container (base image centos7) and cannot read or write to the mounted directory.

I install the directory with gcsfuse as follows:

[ root@6c24c3a6cc28 /]# gcsfuse --foreground --key-file=/src/gcloud_service_account.json my-bucket /gcloud/ Using mount point: /gcloud Opening GCS connection... Opening bucket... Mounting file system... File system has been successfully mounted. 

When I try to read and write to the mounted directory, I get this error:
[root @ 6c24c3a6cc28 /] # ls -la / gcloud / ls: read directory / gcloud /: input / output error of only 0

gcsfuse prints debug information by saying:

fuse: 2016/01/14 01: 33: 41.110260 * fuseops.ReadDirOp error: readAllEntries: ReadEntries: ListObjects: Get https://www.googleapis.com/storage/v1/b/my-bucket/o ? delimiter =% 2F & project = full: the private key must be PEM or simple PKSC1 or PKCS8; parse error: asn1: struct error: tags do not match (16 vs {class: 1 tag: 27 length: 123 isCompound: true}) {optional: false explicit: false application: false defaultValue: tag: stringType: 0 timeType: 0 set : false omitEmpty: false} pkcs1PrivateKey @ 2

I run docker this way: docker run -p 3000: 3000 \
--privileged \ --cap-add SYS_ADMIN \ --device / dev / fuse \ --name gcsfuseTest \ gcsfuseImage

I am not 100% sure that -cap-add SYS_ADMIN and --device / dev / fuse to get me. I put them on other users who mount using a fuse on a docker.

+5
source share
1 answer

I was able to figure this out by turning on some debug flags when running gcsfuse as follows:

gcsfuse --foreground --debug_gcs --debug_http --debug_fuse --debug_invariants --key-file=/src/gcloud_service_account.json dev-my-bucket /gcloud

This returned a lot of information along with this:

"code": 403, "message": "Access Not Configured". API (Cloud JSON API) is not included for your project. Use the Google Developers Console to update your configuration.

I included this API in the Google Devlopers Console, and then after a couple of minutes, vuala, it worked.

+12
source

Source: https://habr.com/ru/post/1240583/


All Articles