Docker build error when using gcsfuse to install google repository

I am trying to connect SQL and repository to my WordPress docker container. It looks like he uninstalled SQL but was unable to install the bucket. The instance is based on this post .

I added the Docker file and the error below, as well as my build command.

Build Command:

docker build -t ic/spm .

Dockerfile:

 FROM wordpress MAINTAINER Gareth Williams < gareth@itinerateconsulting.com > # Move login creds locally ADD ./creds.json /creds.json # install sudo, wget and gcsfuse ENV GCSFUSE_REPO=gcsfuse-jessie RUN apt-get update && \ apt-get -y install sudo && \ apt-get install -y curl ca-certificates && \ echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" > /etc/apt/sources.list.d/gcsfuse.list && \ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ apt-get update && \ apt-get install -y gcsfuse wget && \ apt-get remove -y curl --purge && \ apt-get autoremove -y && \ rm -rf /var/lib/apt/lists/* # Config fuse RUN chmod a+r /etc/fuse.conf RUN perl -i -pe 's/#user_allow_other/user_allow_other/g' /etc/fuse.conf # Setup 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 

Error:

 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 
+6
source share
2 answers

If you use your container in GKE and want to use gcsfuse, permissions should automatically be inherited locally in your account. Also ... there is a caution that you need to make sure that your cluster requires access to the repository. Therefore, make sure that your cluster has full access permissions set. This way, gcsfuse can mount your buckets on GCS in a container without worrying about transferring credential files and all that, which makes the implementation pretty simple.

In your docker file ... make sure you run your apt commands to get and install the gcsfuse application.

I personally created a shell script that I call upon completion of the instance that mounts my directories that I need.

Something like that...

Docker entry

ENTRYPOINT ["/opt/entry.sh"]

entry.sh script example

gcsfuse [gcs bucket name] [local folder to mount as]

When creating a GKE cluster, be sure to add a storage area

gcloud container clusters create [your cluster name] --scopes storage-full

Hope this helps you.

0
source

your www data has a permission problem in the docker file:

 #RUN chown www-data:www-data -R /mnt && groupadd fuse && gpasswd -a www-data fuse && chmod g+rw /dev/fuse 

uncomment this line

-one
source

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


All Articles