docker安装说明: https://blog.youkuaiyun.com/song_java/article/details/88061162
docker镜像地址: https://store.docker.com/community/images/season/fastdfs
宿主机IP地址: 192.168.174.129
使用docker-compose运行fastdfs
version: '2'
services:
tracker:
image: season/fastdfs:1.2
restart: always
volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
- "./tracker_data:/fastdfs/tracker/data"
network_mode: "host"
command: "tracker"
storage:
image: season/fastdfs:1.2
restart: always
volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
- "./storage_base_path:/fastdfs/storage/data"
- "./store_path0:/fastdfs/store_path"
environment:
TRACKER_SERVER: "192.168.174.129:22122"
network_mode: "host"
command: "storage"
nginx:
image: season/fastdfs:1.2
restart: always
volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
- "./nginx.conf:/etc/nginx/conf/nginx.conf"
- "./store_path0:/fastdfs/store_path"
environment:
TRACKER_SERVER: "192.168.174.129:22122"
network_mode: "host"
command: "nginx"
根据docker-compose.yml我们看到主要有3个模块: tracker storage nginx
tracker
挂载 /fastdfs/tracker/data ,这个目录对应的是 tracker.conf中的 base_path
storage
挂载/fastdfs/storage/data ,这个

本文介绍了如何使用docker-compose在宿主机上安装和配置FastDFS、存储模块和Nginx。详细讲解了如何挂载数据目录,设置环境变量,并提供了Nginx配置文件的示例。在启动服务后,通过Java代码展示了FastDFS文件上传和下载的流程,以及如何通过Nginx访问文件。
最低0.47元/天 解锁文章
783





