s3-fuse docker运行试用

s3-fuse 是一个很不错的基于fuse 暴露s3 数据为标准文件系统数据的扩展,以前有基于rpm包运行的demo
以下是基于docker-compose运行demo

一个参考案例

 

 

环境准备

  • docker-compose文件
 
version: "3"
services:
  minio:
    image: minio/minio:RELEASE.2020-04-04T05-39-31Z
    environment:
      - "MINIO_ACCESS_KEY=minio"
      - "MINIO_SECRET_KEY=minio123"
      - "MINIO_BROWSER=off"
    command: server /data
    ports:
      - "80:9000"
  gateway:
    image: minio/minio:RELEASE.2020-04-04T05-39-31Z
    command: gateway s3 http://minio:9000
    ports:
      - "9000:9000"
    environment:
      - "MINIO_ACCESS_KEY=minio"
      - "MINIO_SECRET_KEY=minio123"
  app:
    image: dalongrong/s3-fs:1.86
    privileged: true
    environment:
      - "AWS_KEY=minio"
      - "AWS_SECRET_KEY=minio123"
      - "S3_REGION=us-east-1"
      - "S3_URL=http://minio:9000"
      - "S3_BUCKET=apps"
    volumes: 
    - "./s3:/var/s3"
  • s3-fs Dockerfile
###############################################################################
# The FUSE driver needs elevated privileges, run Docker with --privileged=true
###############################################################################
FROM alpine:3.3
ENV MNT_POINT /var/s3
ENV S3_REGION ''
ARG S3FS_VERSION=v1.86
RUN apk --update --no-cache add fuse alpine-sdk automake autoconf libxml2-dev fuse-dev curl-dev git bash; \
    git clone https://github.com/s3fs-fuse/s3fs-fuse.git; \
    cd s3fs-fuse; \
    git checkout tags/${S3FS_VERSION}; \
    ./autogen.sh; \
    ./configure --prefix=/usr; \
    make; \
    make install; \
    make clean; \
    rm -rf /var/cache/apk/*; \
    apk del git automake autoconf;
RUN mkdir -p "$MNT_POINT"
CMD echo "${AWS_KEY}:${AWS_SECRET_KEY}" > /etc/passwd-s3fs && \
    chmod 600 /etc/passwd-s3fs && \
    /usr/bin/s3fs $S3_BUCKET $MNT_POINT -f -o url=${S3_URL},endpoint=${S3_REGION},allow_other,use_path_request_style,retries=5,connect_timeout=10

使用说明

  • 启动minio
docker-compose up -d minio 
  • 按需启动gateway
    gateway 主要是ui 的
  • 创建bucket以及上传测试文件

 

 

  • 启动s3-fuse 服务
 
docker-compose up -d app

查看内容
容器内部:

 
docker-compose exec app sh
ls /var/s3 

效果

说明

我们基于s3-fuse,可以方便的进行不同容器的数据共享,实际上docker 也提供了基于s3 volume plugin,有点不是很好的地方是需要一些比较高的
权限

参考资料

https://github.com/rongfengliang/minio-s3-fuse-docker-compose-learning
https://github.com/s3fs-fuse/s3fs-fuse
https://github.com/freegroup/kube-s3

posted on   荣锋亮  阅读(1705)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2019-04-07 WRITING POSTGRESQL TRIGGERS IN GO
2019-04-07 C-Language Functions
2018-04-07 nginx unit 安装试用
2018-04-07 nginx ngscript 简单使用
2015-04-07 Redis 3.0正式版发布,正式支持Redis集群

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示