1. 拉镜像
docker search fastdfs;
morunchang/fastdfs 用于存储照片
docker pull morunchang/fastdfs;
2. Tracker 设置 21000 22122
运行 tracker
docker run -d --name tracker --net=host morunchang/fastdfs sh tracker.sh
进入 tracker
docker exec -it tracker /bin/bash
两个端口号: 21000 22122
三个文件:
/etc/nginx/conf/nginx.conf
/etc/fdfs/client.conf
/etc/fdfs/tracker.conf
修改 /etc/nginx/conf/nginx.conf
vim /etc/nginx/conf/nginx.conf
vim /etc/fdfs/client.conf
IP:22122
vim /etc/fdfs/tracker.conf
3. Storage 设置
docker run -d --name storage --net=host
-e TRACKER_IP=192.168.19.129:22122
-e GROUP_NAME=group1 morunchang/fastdfs sh storage.sh
docker run -d --name storage --net=host -e TRACKER_IP=192.168.166.140:22122 -v /home/docker/fastdfs/storage/image:/data/fast_data -e GROUP_NAME=group1 morunchang/fastdfs sh storage.sh
进入 storage
docker exec -it storage /bin/bash
三个文件:
/etc/nginx/conf/nginx.conf
/etc/fdfs/storage.conf
/etc/fdfs/tracker.conf
vim /etc/nginx/conf/nginx.conf
vim /etc/fdfs/client.conf
vim /etc/fdfs/storage.conf
vim /etc/fdfs/storage.conf
照片就存储在 /data/fast_data 下
6. 防止缓存
docker exec -it storage /bin/bash
vim /etc/nginx/conf/nginx.conf
add_header Cache-Control no-store;