Skip to content

maxcotec/s3fs-mount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

s3fs mount from Docker container

alt text

This repository contains a singleton Dockerfile that is capable of mounting s3 bucket as file system using s3fs fuse.

Watch video tutorial on YouTube;

Prerequisite

  • Make sure you already have an s3 bucket in your AWS account.
  • create an IAM user with following policy;
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "s3:ListBucket"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::<s3_bucket>"
        },
        {
            "Action": [
                "s3:DeleteObject",
                "s3:GetObject",
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::<s3_bucket>/*"
        }
    ]
}
  • create security credentials (ACCESS_KEY_ID and SECRET_ACCESS_KEY) for your IAM user.

Usage

Build the image

docker build . -t <your_tag_here> --build-arg BUCKET_NAME=<your_s3_bucket_name>

run container

docker run -it -e ACCESS_KEY_ID=<access_key_id> -e SECRET_ACCESS_KEY=<secret_access_key> --privileged <image_tag>

Using different base image

This Dockerfile uses python:3.8-slim as base image, which is Debian. if the base image you choose has different OS, then make sure to change the installation procedure in Dockerfile (@ line 45) apt install s3fs -y. To install s3fs for desired OS, follow the official installation guide

About

Mount s3 bucket in your Docker containers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published