If you would prefer to use docker-compose for testing on your localhost use the following. Note you don't need to use --privileged flag as we are passing --cap-add SYS_ADMIN --device /dev/fuse flags in the docker-compose.yml
create file .env
AWS_ACCESS_KEY_ID=xxxxxxAWS_SECRET_ACCESS_KEY=xxxxxxAWS_BUCKET_NAME=xxxxxxcreate file docker-compose.yml
version: "3"services: s3-fuse: image: debian-aws-s3-mount restart: always build: context: . dockerfile: Dockerfile environment: - AWSACCESSKEYID=${AWS_ACCESS_KEY_ID} - AWSSECRETACCESSKEY=${AWS_SECRET_ACCESS_KEY} - AWS_BUCKET_NAME=${AWS_BUCKET_NAME} cap_add: - SYS_ADMIN devices: - /dev/fusecreate file Dockerfile. i.e You can use any docker image you prefer but first, check if your distro is supported here
FROM node:16-bullseyeRUN apt-get update -qqRUN apt-get install -y s3fsRUN mkdir /s3_mntTo run container execute:
$ docker-compose run --rm -t s3-fuse /bin/bashOnce inside the container. You can mount your s3 Bucket by running the command:
# s3fs ${AWS_BUCKET_NAME} s3_mnt/Note: For this setup to work .env, Dockerfile and docker-compose.yml must be created in the same directory. Don't forget to update your .env file with the correct credentials to the s3 bucket.