goofys icon indicating copy to clipboard operation
goofys copied to clipboard

Files in S3 bucket don't appear in docker container

Open djtzou opened this issue 8 years ago • 6 comments

Hello all. I have been having problems with mounting a host directory (that has a S3 bucket mounted on using goofys) into a docker container running on an EC2 instance. I ran a docker container that created a bind-mount between the absolute path of the host directory containing the S3 bucket and a directory inside the container. However, the files in the S3 bucket do not appear inside the docker container directory that was specified yet a docker inspect shows that the bind-mounts were successful. Is this a goofys or a docker issue?

djtzou avatar Nov 22 '16 21:11 djtzou

Might be a fuse issue. Have you tried mounting with allow_other?

monken avatar Dec 04 '16 03:12 monken

I've found that docker doesn't show files for mounts that occur after the daemon has been started. Try restarting the daemon and seeing if the mounts show files. We have this issue with goofys and with nfs so its not a goofys specific issue.

msmitherdc avatar Dec 04 '16 15:12 msmitherdc

I do want to make goofys work better in the docker world so suggestions about what it can do better is highly welcomed. Note that I will be traveling for the next two weeks and responses maybe sparse.

kahing avatar Dec 05 '16 09:12 kahing

It could be interesting to official support https://github.com/monder/goofys-docker directly in this repository.

bhack avatar Mar 28 '17 09:03 bhack

I was getting this error, when I ran docker run with the -v mount: docker: Error response from daemon: error while creating mount source path '<goofys_mount>': mkdir <goofys_mount>: file exists.

These 3 things fixed it:

  1. /etc/fuse.conf needs to have "user_allow_other"
  2. "-o allow_other" option needs to be passed to Goofys when mounting the S3 bucket
  3. "--privileged --cap-add=SYS_ADMIN --device /dev/fuse" need to be passed during the docker run statement

Cookt2 avatar Aug 29 '19 20:08 Cookt2

Easying it for the next one:

  s3fs:                                                                                                                                                                                                                                                                                    
    container_name: s3fs                                                                                                                                                                                                                                                                   
    image: gseldon/goofys:latest                                                                                                                                                                                                                                                           
    restart: unless-stopped                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    deploy:                                                                                                                                                                                                                                                                                
      mode: replicated                                                                                                                                                                                                                                                                     
      replicas: 1                                                                                                                                                                                                                                                                          
      placement:                                                                                                                                                                                                                                                                           
        max_replicas_per_node: 1                                                                                                                                                                                                                                                           
        constraints:                                                                                                                                                                                  
          - "node.role == manager"                                                                                                                                                                                                                                                         
    cap_add:                                                                                                                                                                                                                                                                               
      - SYS_ADMIN                                                                                                                                                                                                                                                                          
    security_opt:                                                                                                                                                                                                                                                                          
      - "apparmor:unconfined"                                                                                                                                                                                                                                                              
    devices:                                                                                                                                                                                                                                                                               
      - /dev/fuse                                                                                                                                                                                                                                                                          
    volumes:                                                                                                                                                                                                                                                                               
      - /mnt/storage:/mnt/storage:rshared                                                                                                                                                                                                                                                  
      - /var/s3fs/docker/etc/fuse.conf:/etc/fuse.conf:ro                                                                                                                                                                                                                         
      - /var/s3fs/docker/root/.aws/credentials:/root/.aws/credentials:ro                                                                                                                                                                                                         
    environment:                                                                                                                                                                                                                                                                           
        ENDPOINT: https://nyc3.digitaloceanspaces.com                                                                                                                                                                                                                                      
        BACKETNAME: mystorage                                                                                                                                                                                                                                                          
        MOUNTPOINT: /mnt/storage                                                                                                                                                                                                                                                           
        UID: 1000                                                                                                                                                                                                                                                                          
        GID: 1000                                                                                                                                                                                                                                                                          
        FILEMOD: 0664                                                                                                                                                                                                                                                                      
        DIRMODE: 0774                                                                                                                                                                                                                                                                      
        S3FS_ARGS: -o allow_other

EthraZa avatar Jul 16 '21 15:07 EthraZa