Detailed example of installing FastDfs file server using docker compose

Detailed example of installing FastDfs file server using docker compose

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

Note:
network_mode must be host, because when uploading files, the tracker will send the storage IP and port to the client. If it is bridge mode, it will send the internal network IP, which the client cannot access.
Use season/fastdfs:1.2 as the image. Do not use lastest, because lastest does not include the nginx service. Other fastdfs images are not as streamlined as season.

nginx.conf (used to provide http download files)

listen 7003 is the ngingx service access port, which can be switched by yourself

#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;
        }
 }
}

This is the end of this article about installing FastDfs file server with docker-compose. For more information about installing FastDfs with docker-compose, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Some notes on installing fastdfs image in docker
  • Building FastDFS file system in Docker (multi-image tutorial)
  • How to install FastDFS in Docker
  • How to deploy FastDFS in Docker
  • How to use docker compose to build fastDFS file server

<<:  Vue close browser logout implementation example

>>:  Use @font-face to implement special characters on web pages (create custom fonts)

Recommend

HTML+jQuery to implement a simple login page

Table of contents Introduction Public code (backe...

Tutorial on setting up scheduled tasks to backup the Oracle database under Linux

1. Check the character set of the database The ch...

Best way to replace the key in json object

JSON (JavaScript Object Notation, JS Object Notat...

Use of docker system command set

Table of contents docker system df docker system ...

React uses emotion to write CSS code

Table of contents Introduction: Installation of e...

Implementation and usage scenarios of JS anti-shake throttling function

Table of contents 1. What is Function Anti-shake?...

Example of using UserMap in IMG

usemap is an attribute of the <img> tag, use...

How to operate MySQL database with ORM model framework

What is ORM? ORM stands for Object Relational Map...

Detailed explanation of flex layout in CSS

Flex layout is also called elastic layout. Any co...

Implementation code for installing vsftpd in Ubuntu 18.04

Install vsftpd $ sudo apt-get install vsftpd -y S...

How to install and configure the supervisor daemon under centos7

Newbie, record it yourself 1. Install supervisor....

MySQL deadlock routine: inconsistent batch insertion order under unique index

Preface The essence of deadlock is resource compe...

Nginx forwarding based on URL parameters

Use scenarios: The jump path needs to be dynamica...