在docker中读取或写入挂载目录时,gcsfuse会给出输入/输出错误 [英] gcsfuse gives a Input/output error when reading or writing to mounted directory in docker

查看:1137
本文介绍了在docker中读取或写入挂载目录时,gcsfuse会给出输入/输出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在docker容器(base image centos7)中使用gcsfuse,并且无法读取或写入已挂载的目录。



我正在加载目录gcsfuse这样:

  [root @ 6c24c3a6cc28 /]#gcsfuse --foreground --key-file = / src / gcloud_service_account。 json my-bucket / gcloud / 
使用挂载点:/ gcloud
打开GCS连接...
打开桶...
挂载文件系统...
文件系统已成功安装。

当我尝试读取或写入挂载的目录时,我收到以下错误:

[root @ 6c24c3a6cc28 /]#ls -la / gcloud /
ls:阅读目录/ gcloud /:输入/输出错误
总计0



gcsfuse打印出调试信息:



fuse:2016/01/14 01:33:41.110260 * fuseops.ReadDirOp错误:readAllEntries:ReadEntries:ListObjects:Get 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}){可选:false显式:false应用程序:false defaultValue:tag:stringType:0 timeType: 0 set:false omitEmpty:false} pkcs1PrivateKey @ 2



我正在运行docker,如下所示:
docker run -p 3000:3000 \

--privileged \
--cap-add SYS_ADMIN \
--device / dev / fuse \
- name gcsfuseTest \
gcsfuseImage

我不是100%确定什么--cap-add SYS_ADMIN和--device / dev / fuse让我。我把它们放在基于其他用户在Docker上使用保险丝的用户。

解决方案

我能够通过转动在运行gcsfuse这样的一些调试标志:



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



这返回了很多信息,连同这样: p>

代码:403,
消息:未配置访问权限,您的项目未启用API(云存储JSON API)请使用Google Developers Console更新您的配置。



我在Google Devlopers控制台中启用了此API,然后几分钟后,vuala工作。


I am using gcsfuse within a docker container (base image centos7) and am not able to read or write to the mounted directory.

I am mounting the directory with gcsfuse like this:

[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 and read or write to the mounted directory, I get this error:
[root@6c24c3a6cc28 /]# ls -la /gcloud/ ls: reading directory /gcloud/: Input/output error total 0

gcsfuse prints out debug info 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&projection=full: private key should be a PEM or plain PKSC1 or PKCS8; parse error: asn1: structure error: tags don't 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 am running docker like this: docker run -p 3000:3000 \

--privileged \
 --cap-add SYS_ADMIN \
 --device /dev/fuse \
 --name gcsfuseTest \
 gcsfuseImage

I am not 100% certain what --cap-add SYS_ADMIN and --device /dev/fuse get me. I put them in based on other users who are mounting using fuse on docker.

解决方案

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

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

This returned lots of info, along with this:

"code": 403, "message": "Access Not Configured. The API (Cloud Storage JSON API) is not enabled for your project. Please use the Google Developers Console to update your configuration."

I enabled this API within the Google Devlopers Console, then after a couple minutes, vuala, it worked.

这篇关于在docker中读取或写入挂载目录时,gcsfuse会给出输入/输出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆