How to install FastDFS in Docker

How to install FastDFS in Docker

Pull the image

docker pull season/fastdfs:1.2

Start Tracker

docker run -ti -d --name trakcer -v /opt/fastdfs/tracker_data:/fastdfs/tracker/data --net=host season/fastdfs:1.2 tracker

Start Storage

Note that replace {ipaddress}

docker run -ti -d --name storage -v /opt/fastdfs/storage_data:/fastdfs/storage/data -v /opt/fastdfs/store_path:/fastdfs/store_path --net=host -e TRACKER_SERVER:{ipaddress}:22122 season/fastdfs:1.2 storage

Modify the configuration file

The directory of vim is the directory after cp, such as my directory is /usr/local/fastdfs/conf
Replace the following parameters in the configuration file with your corresponding IP

docker cp storage:/fdfs_conf/. /usr/local/fastdfs/conf

vim tracker.conf
bind_addr=${ipaddress}

vim storage.conf
tracker_server=${ipaddress}:22122

vim-client.conf
tracker_server=${ipaddress}:22122

#cp the modified configuration file back to the image docker cp /usr/local/fastdfs/conf/. storage:/fdfs_conf

#Restart the storage service docker restart storage

Configure Nginx

Mount nginx.conf and mod_fastdfs.conf in the storage service

#Add location /group1/M00 to the nginx.conf configuration file {
      #root /fastdfs/store_path/data;
      ngx_fastdfs_module;
}

#Configure cross-domain in the server. Configure cross-domain in the server. add_header 'Access-Control-Allow-Origin' '*';
  add_header 'Access-Control-Allow-Credentials' 'true';
  add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

#Add url_have_group_name=true in mod_fastdfs.conf

Start Nginx

Note: When starting nginx, you need to map the paths of nginx.conf and mod_fastdfs.conf mounted in the previous step, so you need to write them according to your own paths, and remember to replace the {ipaddress} parameter

docker run -id --name fastdfs_nginx --restart=always -v /opt/fastdfs/store_path:/fastdfs/store_path -v /usr/local/fastdfs/nginx_conf/nginx.conf:/etc/nginx/conf/nginx.conf -v /usr/local/fastdfs/nginx_conf/mod_fastdfs.conf:/etc/fdfs/mod_fastdfs.conf -p 8888:80 -e GROUP_NAME=group1 -e TRACKER_SERVER={ipaddress}:22122 -e STORAGE_SERVER_PORT=23000 season/fastdfs:1.2 nginx

Configuring the Firewall

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

This is the end of this article about the steps to install FastDFS on Docker. For more information about installing FastDFS on Docker, 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:
  • Detailed example of installing FastDfs file server using docker compose
  • Some notes on installing fastdfs image in docker
  • Building FastDFS file system in Docker (multi-image tutorial)
  • How to deploy FastDFS in Docker
  • How to use docker compose to build fastDFS file server

<<:  Web page HTML code: production of scrolling text

>>:  How to center images horizontally and vertically in DIV or DIV

Recommend

How to understand Vue front-end and back-end data interaction and display

Table of contents 1. Technical Overview 2. Techni...

Docker configures the storage location of local images and containers

Use the find command to find files larger than a ...

How to monitor global variables in WeChat applet

I recently encountered a problem at work. There i...

MySQL 8.0.12 Simple Installation Tutorial

This article shares the installation tutorial of ...

Navicat for MySQL 11 Registration Code\Activation Code Summary

Recommended reading: Navicat12.1 series cracking ...

Detailed process of building nfs server using Docker's NFS-Ganesha image

Table of contents 1. Introduction to NFS-Ganesha ...

Detailed explanation of the role of explain in MySQL

1. MYSQL index Index: A data structure that helps...

Detailed analysis of classic JavaScript recursion case questions

Table of contents What is recursion and how does ...

Analysis of the principle and creation method of Mysql temporary table

This article mainly introduces the principle and ...

VMware installation of Centos8 system tutorial diagram (Chinese graphical mode)

Table of contents 1. Software and system image 2....

Detailed explanation of the new background properties in CSS3

Previously, we knew several attributes of backgro...

Write a shopping mall card coupon using CSS in three steps

Today is 618, and all major shopping malls are ho...

Mysql join query syntax and examples

Connection query: It is the result of connecting ...