1. 程式人生 > >8、Docker 安裝 FastDFS

8、Docker 安裝 FastDFS

Docker 安裝 FastDFS

拉取FastDFS映象

[[email protected] ~]# docker pull morunchang/fastdfs
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: TLS handshake timeout
[[email protected] ~]# docker pull morunchang/fastdfs
Using default tag: latest
latest: Pulling from morunchang/fastdfs
43db9dbdcb30: Pull complete 
85a9cd1fcca2: Pull complete 
c23af8496102: Pull complete 
e88c36ca55d8: Pull complete 
492fed9ec7f3: Pull complete 
0c1d41dbb2bd: Pull complete 
99b513124929: Pull complete 
bf3f5901a13d: Pull complete 
88bf4f57c2c5: Pull complete 
Digest: sha256:f3fb622783acee7918b53f8a76c655017917631c52780bebb556d29290955b13
Status: Downloaded newer image for
morunchang/fastdfs:latest [[email protected] ~]#

執行tracker例項;

[[email protected] ~]# docker run -d --name e3mall-fastdfs-tracker --net=host morunchang/fastdfs sh tracker.sh
63803049d69ea0a0bdf53c07c80998f5518c10dac045b5b356101014d51941f1
[[email protected] ~]# 

執行storage例項;

[[email protected]
~]# docker run -d --name e3mall-fastdfs-storage --net=host -e TRACKER_IP=192.168.25.11:22122 -e GROUP_NAME=group1 morunchang/fastdfs sh storage.sh f5fdaba637e84c9fda5996fba1771bed3cb554ef651987c41f311b702fccca83 [[email protected] ~]#

修改nginx的配置,不攔截上傳內容;

# 1. 進入容器
docker exec -it e3mall-fastdfs-storage  /bin/bash
# 2. 編輯nginx配置檔案
vi /data/nginx/conf/nginx.conf # 3. 修改以下內容 location /group1/M00 { proxy_next_upstream http_502 http_504 error timeout invalid_header; proxy_cache http-cache; proxy_cache_valid 200 304 12h; proxy_cache_key $uri$is_args$args; proxy_pass http://fdfs_group1; expires 30d; } # 4. 退出 exit # 5. 重啟storage容器 docker restart e3mall-fastdfs-storage

開啟防火牆 8080802212223000 四個埠;

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=22122/tcp --permanent
firewall-cmd --zone=public --add-port=23000/tcp --permanent
firewall-cmd --reload