使用docker compose安装FastDfs文件服务器的实例详解
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, 原因是当上传文件时,tracker会把storage的IP和端口发给client,如果是bridge模式,则发送的是内网IP,client无法访问到。
image采用season/fastdfs:1.2 不要用lastest, 因为lastest不包含nginx服务,其他fasdfs镜像均没有season的精简。
nginx.conf(用于提供http的方式下载文件)
listen 7003是ngingx服务访问端口,可自行切换
#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;
}
}
}
上一篇:超详细Docker Desktop下安装rocketmq的教程
栏 目:其它服务器
本文标题:使用docker compose安装FastDfs文件服务器的实例详解
本文地址:https://zz.feitang.co/server/33079.html
您可能感兴趣的文章
- 01-12Docker部署rabbitmq遇到的两个问题
- 01-12最新虚拟机VMware 14安装教程
- 01-12使用docker compose安装harbor私有仓库的详细教程
- 01-12Windows下Docker安装各种软件的详细过程
- 01-12seata docker 高可用部署的详细介绍
- 01-12浅谈Tomcat多层容器的设计
- 01-12Gogs+Jenkins+Docker 自动化部署.NetCore的方法步骤
- 01-12解决vscode docker插件docker.socket权限问题
- 01-12Docker中运行PostgreSQL并推荐几款连接工具
- 01-12Docker核心原理之 Cgroup详解


阅读排行
推荐教程
- 12-07一文教你怎么选择Tomcat对应的JDK版本
- 12-23linux中ftp无法访问怎么办
- 12-11docker存储目录迁移示例教程
- 12-10docker start启动容器后仍然exit状态的解决
- 12-10Linux下如何安装Logstash
- 12-05Docker安装Jenkins全过程
- 01-05Shell脚本去重的几种方法实例
- 12-22kvm虚拟机配置NAT端口转发的实现方法
- 12-19Zabbix SAML SSO 登录绕过漏洞的操作流程
- 12-15Docker-Compose搭建Spark集群的实现方法




