Azure / azure-storage-fuse

A virtual file system adapter for Azure Blob storage
Other
653 stars 206 forks source link

Cannot see files in mounted folder from within a Docker container #1522

Open JackCaster opened 9 hours ago

JackCaster commented 9 hours ago

Which version of blobfuse was used?

blobfuse2 version 2.3.2

Which OS distribution and version are you using?

Linux Debian

If relevant, please share your mount command.

blobfuse2 mount <...> --config-file=.blobfuse2.yml --subdirectory=<...> --tmp-path=<...>

What was the issue encountered?

I am working with a Docker container (specifically, a VS Code Dev Container). If I mount the blob before I start the Docker container, then I can see the files in the mounted folder. If I mount the blob after I started the Docker container (from a terminal in the host---not within the Docker), I can only see mounted folder but not the actual files.

Have you found a mitigation/solution?

No

Config

allow-other: true # adjust also etc/fuse.conf

logging:
  type: syslog
  level: log_debug

components:
  - libfuse
  - file_cache
  - attr_cache
  - azstorage

libfuse:
  attribute-expiration-sec: 120
  entry-expiration-sec: 120
  negative-entry-expiration-sec: 240

file_cache:
  timeout-sec: 120
  max-size-mb: 4096

attr_cache:
  timeout-sec: 7200

azstorage:
  type: block
  account-name: <...>
  container: <...>
  mode: sas # set env variable AZURE_STORAGE_SAS_TOKEN
JackCaster commented 9 hours ago

To be precise, reloading the container fixes the problem sometimes. Rebuilding the container seems to be the most consistent way to get access to the mounted data

vibhansa-msft commented 7 hours ago

Can you try the same without container. I feel this has something to do with the environment and not blobfuse.

JackCaster commented 7 hours ago

Without container it works, so all files are visible. But when the container is running, those files are not visible from within the docker, while being available in the host. Afaik, the folders in the host (included the blobfuse ones) are bind-mounted in the container.

It used to work few months ago (I can’t be too specific on what version I was on), where the mounted blob acted like any other folder. Now, I think there is something about the caching. If I mount the blob and rebuild the container, the files are there. Then, if I unmount the blob in the host, the files remain visible in the container.

I will open an issue on the vscode repo too.

vibhansa-msft commented 4 hours ago

If you have mounted on host and then trying to access it via container, that migth not work. For Blobfuse to work, file-system calls have to reach it via kernel. In case of container accessing the file-system it might be some docker mechanism to access the files and hence I doubt. For your case to work, I suggest mounting inside the container itself.

JackCaster commented 4 hours ago

Thanks but I do not fully understand. Are you suggesting that the docker mount mechanism (bind mount) is not compatible with a blobfuse mount?

EDIT

... I suggest mounting inside the container itself.

This could work but it is not ideal. I use blobfuse2 on the host as I need that data available in my system. But I use the devcontainer for some specific development work. I would expect the mapping to work as with other normal local folder

EDIT2 Also, the dockerfile becomes much more complex if I included blobfuse functionalities, which makes collaborative work more complex too (as other collaborators may deal with data in a different way and not use blobfuse at all)

EDIT3 I tried block_cache instead of file_cache and the content of the blobfuse mount is updated in the Docker container after I restarted the container (the file_cache, instead, requires a rebuilt)