參考網址:
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