1. 获取镜像

  1. # 查看可用的稳定版本
  2. sudo docker search fastdfs
  3. sudo docker pull qbanxiaoli/fastdfs
  4. sudo docker image ls |grep fastdfs

2. 创建数据卷

  1. sudo mkdir -p /home/fastdfs/data
  2. # 赋予data目录读写权限
  3. sudo chmod 777 /home/fastdfs/data

3. 启动容器

  1. sudo docker run -d --name fastdfs \
  2. -v /home/fastdfs/data:/var/local/fdfs \
  3. --restart=always \
  4. --privileged=true \
  5. --net=host \
  6. -e IP=${IP} \
  7. -e WEB_PORT=80 \
  8. qbanxiaoli/fastdfs
  9. # 参数说明
  10. ## IP:服务器公网ip或者虚拟机的IP
  11. ## WEB_PORT:指定nginx端口
  12. sudo docker start fastdfs
  13. sudo docker restart fastdfs
  14. sudo docker stop fastdfs
  15. sudo docker rm fastdfs

4. 验证

  1. sudo docker exec -it fastdfs /bin/bash
  2. echo "Hello FastDFS!" > index.html
  3. fdfs_test /etc/fdfs/client.conf upload index.html

参考

语雀:docker-fastDFS安装
https://www.yuque.com/zukxu/docker/vltrfg