我一直在尝试将sql和存储桶安装到我的docker wordpress容器中.它似乎成功安装了sql,但未能安装存储桶.该实例基于this post.
我已经在下面附加了Docker文件和错误,以及我的构建命令.
构建命令:
docker build -t ic / spm.
Dockerfile:
FROM wordpress MAINTAINER Gareth Williams
@H_301_16@sql proxy RUN sudo mkdir /cloudsql RUN sudo chmod 777 /cloudsql ADD https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 cloud_sql_proxy.linux.amd64 RUN mv cloud_sql_proxy.linux.amd64 cloud_sql_proxy && chmod +x ./cloud_sql_proxy RUN ./cloud_sql_proxy -dir=/cloudsql -fuse -credential_file=/creds.json & # MysqL -u icroot -S /cloudsql/[INSTANCE_CONNECTION_NAME] # Perform Cloud Storage FUSE mounting for uploads folder RUN mkdir /mnt/uploads RUN chmod a+w /mnt/uploads #RUN chown www-data:www-data -R /mnt && groupadd fuse && gpasswd -a www-data fuse && chmod g+rw /dev/fuse USER www-data RUN gcsfuse --key-file /creds.json \ --debug_gcs --debug_http --debug_fuse --debug_invariants \ --dir-mode "777" -o allow_other spm-bucket /mnt/uploads 错误:
Step 17 : RUN gcsfuse --key-file /creds.json --foreground --debug_gcs --debug_http --debug_fuse --debug_invariants --dir-mode "777" -o allow_other spm-bucket /mnt/uploads ---> Running in 7e3f31221bee Using mount point: /mnt/uploads opening GCS connection... opening bucket... gcs: Req 0x0: <- ListObjects() http: ========== REQUEST: GET http://www.googleapis.com/storage/v1/b/spm-bucket/o?maxResults=1&projection=full HTTP/1.1 Host: www.googleapis.com User-Agent: gcsfuse/0.0 Authorization: Bearer ya29.ElrQAw8oxClKt8YGvtmxhc7z2Y2LufvL0fBueq1UESjYYjRrdxukNTQqO1qfM8e8h-rqfbOWNSjVK2rCRXVrEDla-CiUVhHwT6X71Y1Djb0jDJg7z3KblgNQPrc Accept-Encoding: gzip http: ========== RESPONSE: HTTP/2.0 200 OK Content-Length: 31 Alt-Svc: quic=":443"; ma=2592000; v="35,34" Cache-Control: private,max-age=0,must-revalidate,no-transform Content-Type: application/json; charset=UTF-8 Date: Wed,11 Jan 2017 09:19:05 GMT Expires: Wed,11 Jan 2017 09:19:05 GMT Server: UploadServer Vary: Origin Vary: X-Origin X-Guploader-Uploadid: AEnB2UpTqXhtHW906FFDTRsz4FjHjFu_E84wYhvt0zhaVFuMpqSY1fsd1XcrEcpsYBBwX1mqf0ZXRVWJH05ThtDQIfFKHd4PFw { "kind": "storage#objects" } http: ==================== gcs: Req 0x0: -> ListObjects() (1.793169206s): OK Mounting file system... mountWithArgs: mountWithConn: Mount: mount: running fusermount: exit status 1 stderr: fusermount: Failed to open /dev/fuse: Operation not permitted
@H_301_16@
最佳答案
如果您在GKE上运行容器,并且想要使用gcsfuse,则应在您的帐户中自动继承权限.另外……需要注意的是,您需要确保运行所需的群集具有存储访问权限.因此,请确保您的群集具有设置为完全访问权限的存储权限.这样gcsfuse可以将容器挂载到容器中的GCS上,而不必担心传递凭证文件和所有这些东西……使得实现非常简单.
在你的docker文件中…确保你正在使用apt命令来获取和安装gcsfuse应用程序.
我亲自制作了一个shell脚本,一旦实例启动就调用它,它会挂载我需要的目录.
像这样……
Docker Entry
ENTRYPOINT [“/ opt / entry.sh”]
entry.sh脚本示例
gcsfuse [gcs bucket name] [要挂载的本地文件夹]
gcloud容器集群创建[您的集群名称] –scopes storage-full
希望这对你有所帮助.