参考网址:
https://hub.docker.com/r/season/fastdfs
https://www.cnblogs.com/provence666/p/10987156.html
1.拉取fastdfs镜像
docker pull season/fastdfs
2.使用docker镜像构建tracker容器(跟踪服务器,起到调度的作用)
docker run -ti -d --name trakcer -v /opt/fastdfs/tracker_data:/fastdfs/tracker/data --net=host season/fastdfs tracker
3.使用docker镜像构建storage容器(存储服务器,提供容量和备份服务)
docker run -dti --net=host --name fastdfs -e TRACKER_SERVER:192.168.1.136:22122 -v /opt/fastdfs/storage_data:/fastdfs/storage/data -v /opt/fastdfs/store_path:/fastdfs/store_path -v /etc/localtime:/etc/localtime season/fastdfs storage
TRACKER_SERVER=本机的ip地址:22122 本机ip地址不要使用127.0.0.1
4.拷贝storage容器配置文件到宿主机
docker cp storage:/fdfs_conf /opt/fastdfs/fdfs_conf
5.进入/opt/fastdfs/fdfs_conf查看哪些涉及tracker_server
grep "tracker_server" ./*
6.删除storage容器,重新启动并挂载配置文件目录
docker run -dti --net=host --name fastdfs -e TRACKER_SERVER:192.168.1.136:22122 -v /opt/fastdfs/storage_data:/fastdfs/storage/data -v /opt/fastdfs/store_path:/fastdfs/store_path -v /opt/fastdfs/fdfs_conf:/fdfs_conf -v /etc/localtime:/etc/localtime season/fastdfs storage