1、准备工作
bash
docker pull qinziteng/fastdfs:5.05
Pwd="/data/software/fastdfs"
mkdir ${Pwd}/{storage,tracker} -p
2、创建TEST容器,将fastdfs目录COPY到本地,方便后续维护管理!
bash
docker run -id --name fastdfs qinziteng/fastdfs:5.05
docker cp fastdfs:/home/fastdfs/conf /etc/fdfs
docker rm -f fastdfs
3、运行容器
注意:TRACKER_SERVER
变量请替换成当前服务器IP:22122
!!!
bash
docker run -id --name fastdfs \
-v ${Pwd}/storage:/home/fastdfs/storage \
-v ${Pwd}/tracker:/home/fastdfs/tracker \
-v /etc/localtime:/etc/localtime \
-v /etc/fdfs:/home/fastdfs/conf \
--restart=always \
--net host \
-e TRACKER_SERVER="16.32.15.115:22122" \
qinziteng/fastdfs:5.05
4、测试上传文件
bash
docker exec -it fastdfs /bin/bash
echo "qinzt six six six ...." > six.txt
fdfs_upload_file /home/fastdfs/conf/client.conf six.txt
group1/M00/00/00/ECAPc2UPhBeADjk6AAAAGQ029dQ115.txt
OK,上传成功。