我在 docker 容器(基本镜像 centos7)中使用 gcsfuse,但无法读取或写入已安装的目录。
我正在使用 gcsfuse 安装目录,如下所示:
[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.
当我尝试读取或写入已安装的目录时,我收到此错误:
[root@6c24c3a6cc28/]# ls -la/gcloud/
ls: 读取目录/gcloud/: 输入/输出错误
共 0
gcsfuse 打印出调试信息:
熔断器:2016/01/14 01:33:41.110260 *fuseops.ReadDirOp 错误:readAllEntries:ReadEntries:ListObjects:获取 https://www.googleapis.com/storage/v1/b/my-bucket/o ? delimiter=%2F&projection=full:私钥应该是 PEM 或普通 PKSC1 或 PKCS8;解析错误:asn1:结构错误:标签不匹配(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
我正在像这样运行 docker:
docker run -p 3000:3000\
--特权\
--cap-添加 SYS_ADMIN\
--设备/开发/ fuse \
--name gcsfuseTest\
gcsfuseImage
我不能 100% 确定 --cap-add SYS_ADMIN 和 --device/dev/fuse 能得到什么。我根据在 docker 上使用 fuse 安装的其他用户将它们放入。
最佳答案
我可以通过在运行 gcsfuse 时打开一些调试标志来解决这个问题:
gcsfuse --foreground --debug_gcs --debug_http --debug_fuse --debug_invariants --key-file=/src/gcloud_service_account.json dev-my-bucket/gcloud
这返回了很多信息,以及:
“代码”:403, "message": "访问未配置。您的项目未启用 API(云存储 JSON API)。请使用 Google Developers Console 更新您的配置。"
我在 Google 开发者控制台中启用了这个 API,几分钟后,vuala,它工作了。
关于docker - gcsfuse 在 docker 中读取或写入挂载目录时出现输入/输出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34779921/