使用docker compose安裝FastDfs文件服務(wù)器的實(shí)例詳解
docker-compose.yml
version: '2'
services:
fastdfs-tracker:
hostname: fastdfs-tracker
container_name: fastdfs-tracker
image: season/fastdfs:1.2
network_mode: "host"
command: tracker
volumes:
- ./tracker_data:/fastdfs/tracker/data
fastdfs-storage:
hostname: fastdfs-storage
container_name: fastdfs-storage
image: season/fastdfs:1.2
network_mode: "host"
volumes:
- ./storage_data:/fastdfs/storage/data
- ./store_path:/fastdfs/store_path
environment:
- TRACKER_SERVER=xxx.xxx.xxx.xxx:22122
command: storage
depends_on:
- fastdfs-tracker
fastdfs-nginx:
hostname: fastdfs-nginx
container_name: fastdfs-nginx
image: season/fastdfs:1.2
network_mode: "host"
volumes:
- ./nginx.conf:/etc/nginx/conf/nginx.conf
- ./store_path:/fastdfs/store_path
environment:
- TRACKER_SERVER=xxx.xxx.xxx.xxx:22122
command: nginx
需要注意:
network_mode 必須是host, 原因是當(dāng)上傳文件時(shí),tracker會(huì)把storage的IP和端口發(fā)給client,如果是bridge模式,則發(fā)送的是內(nèi)網(wǎng)IP,client無法訪問到。
image采用season/fastdfs:1.2 不要用lastest, 因?yàn)閘astest不包含nginx服務(wù),其他fasdfs鏡像均沒有season的精簡。
nginx.conf(用于提供http的方式下載文件)
listen 7003是ngingx服務(wù)訪問端口,可自行切換
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 7003;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /group1/M00 {
root /fastdfs/storage/data;
ngx_fastdfs_module;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
到此這篇關(guān)于使用docker-compose安裝FastDfs文件服務(wù)器的文章就介紹到這了,更多相關(guān)docker-compose安裝FastDfs內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
docker run 運(yùn)行容器自動(dòng)結(jié)束的解決
這篇文章主要介紹了docker run 運(yùn)行容器自動(dòng)結(jié)束的解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-11-11
Docker部署nGrinder性能測試平臺(tái)過程解析
這篇文章主要介紹了Docker部署nGrinder性能測試平臺(tái)過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-11-11
docker安裝,yum安裝失敗解決方案,阿里云鏡像安裝過程
在配置Yum源遇到問題時(shí),嘗試使用阿里云鏡像可以有效解決,本文詳細(xì)介紹了如何配置阿里云源及安裝Docker的步驟,首先,若Yum源配置出錯(cuò),建議更換為阿里云鏡像;其次,詳述了安裝Docker的具體命令,包括啟用阿里云源和安裝過程中的選擇提示2024-11-11
Mac OSX系統(tǒng) Docker啟用Docker遠(yuǎn)程API功能
這篇文章主要介紹了Mac OSX系統(tǒng) Docker啟用Docker遠(yuǎn)程API功能的相關(guān)資料,需要的朋友可以參考下2016-10-10

