Sign inSign up

ecor/centos-s3fs

By ecor

Updated about 11 years ago

Mount Amazon S3 buckets as directories in a CentOS environment.

Image
1

1.8K

ecor/centos-s3fs repository overview

ecor/s3fs-centos

This image, based on CentOS 7, mounts zero or more S3 buckets to the file system. Each mount point leverages caching to save bandwidth. This image was really designed as a base image on which other images can be built. It must be run as a privileged container, and the mounts will be accessible to the entire system. It expects the following environment variables:

  • AWS_KEY: Your AWS key.
  • AWS_SECRET: Your AWS secret.
  • AWS_BUCKET: This can be a space delimited list of bucket names.
  • AWS_MOUNT_PREFIX (Optional): This is the base directory where the buckets will be mounted. By default, this is /S3. If AWS_BUCKET is set to my.bucket.a my.bucket.b, then two mounts will be created and accessible at /S3/my.bucket.a and /S3/my.bucket.b.

The key/secret must have a minimum of read and list permissions on the buckets in order to work. write permissions are also required if you want to copy anything to the mounted directories.

Testing the Container

To test the system, run an ephemeral container:

docker run --rm --name s3fs \
-e AWS_KEY=MYKEY \
-e AWS_SECRET=MYSECRET \
-e AWS_BUCKET="my.first.bucket my.second.bucket" \
-e AWS_MOUNT_PREFIX=/S3 \
--privileged \
ecor/centos-s3fs

This should render output like:

Mounted AWS Bucket: /S3/my.first.bucket
Mounted AWS Bucket: /S3/my.second.bucket

Building on the Container

Building on this container is like any other, but this won't do anything until the mount is initated. A command called mountS3 (available at /usr/bin/mountS3) can be called in the child container when the file system should be mounted. This needs to be done in the CMD or ENTRYPOINT command, because this is the only time Docker has the permissions required to mount a drive.

Examples:

CMD ["mountS3"]
ENTRYPOINT ["/usr/bin/mountS3"]

Contributions

I'd love to have an alpine linux-based version of this instead of CentOS if someone has time.

Tag summary

Content type

Image

Digest

sha256:96396d1b0

Size

189.8 MB

Last updated

about 11 years ago

docker pull ecor/centos-s3fs