Is it possible to mount an s3 bucket as a point in a docker container?

129

Solution 1

No you can't.

S3 is an object storage, accessed over HTTP or REST for example. Just as you can't mount an HTTP address as a directory you can't mount a S3 bucket as a directory.

Having said that there are some workarounds that expose S3 as a filesystem - e.g. 's3fs' project. How reliable and stable they are I don't know.

Solution 2

Yes , you can ( and in swarm mode you should )

Solution 3

Actually, you can use Fuse (eluded to by the answer above).

S3FS-FUSE: This is a free, open-source FUSE plugin and an easy-to-use utility which supports major Linux distributions & MacOS. S3FS also takes care of caching files locally to improve performance. This plugin simply shows the Amazon S3 bucket as a drive on your system.

https://tecadmin.net/mount-s3-bucket-centosrhel-ubuntu-using-s3fs/

I haven't used it in AWS yet, though I'll be trying it soon. There is a similar solution for Azure blob storage and it worked well, so I'm optimistic.

Share:
129

Related videos on Youtube

Ahmed
Author by

Ahmed

Updated on September 18, 2022

Comments

  • Ahmed
    Ahmed over 1 year

    I have an irritating problem, I'm creating an asp.net web service; this service should expose the functionality of an existing library, the service allows users to Upload files to our server by invoking the UploadFile method on the service. Here's the signature of the UploadFile method

    public bool UploadFile(string bucketName, string desiredFileName, System.IO.Stream fileData)
    


    Now, when I try to invoke this method and pass it a System.IO.Stream object referring to the file to be uploaded, I get a compile time error, indicating the the passed in type (System.IO.Stream) is not the expected type (Mynamespace.ServiceReference.Stream). I tried to explicitly cast my stream to the type (Mynamespace.ServiceReference.Stream) but the compiler wouldn't let me do it either, though they are of the same type! weired!

    • Ahmed
      Ahmed almost 15 years
      I think i'm more attracted to Liyod answer, so, accepted!
  • Ahmed
    Ahmed almost 15 years
    So no way to pass a System.IO.Stream as the service requires!?? and why was that conflict anyway?
  • Ahmed
    Ahmed almost 15 years
    So no way to pass a System.IO.Stream as the service requires!?? and why was that conflict anyway?
  • Lloyd
    Lloyd almost 15 years
    The conflict was because the WSDL generator/importer will attempt to create a serializable type from System.IO.Stream. To see this in action create a dummy class, Bob, and add method in your web service which users or returns it. You should where possible stick to primitive types and structs.
  • this. __curious_geek
    this. __curious_geek almost 15 years
    The file stream is always only accessible on single machine. We can not have streamReader or streamWriter remotely for the File I/O, Before that there must be a NetworkStream to exchange the data and then have a local file stream to write that data.
  • Pal Pandi
    Pal Pandi about 3 years
  • maw230
    maw230 over 2 years
    This should not be the accepted answer.