Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build FTP Services in Docker

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to build Docker FTP service, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

One line of command

Docker run-d\-v / share:/home/vsftpd\-p 20:20\-p 21:21\-p 21100-21110 FTP_USER=zhaoolee 21100-21110\-e FTP_USER=zhaoolee\-e FTP_PASS=eelooahz\-e PASV_ADDRESS=47.106.108.135\-e PASV_MIN_PORT=21100\-e PASV_MAX_PORT=21100\-- name zhaoolee_vsftpd\-- restart=always\ fauria/vsftpd

Parameter explanation:

-d indicates that the new container is running in the background

-v indicates setting directory mapping setup example-v / share:/home/vsftpd maps the / share directory of the host to the / home/vsftpd of the docker container (after the user zhaoolee logs in, the program automatically creates a new zhaoolee folder under the / home/vsftpd folder to store the uploaded files)

-p is the mapped port-p 20:20 means that port 20 of the host is mapped to port 20 of the docker container,-p 21:21 means that port 21 of the host is mapped to port 21 of the docker container,-p 21100-21110 pur21100-21110 means that ports 21100 to 21110 of the host are mapped to ports 21100 to 21110 of the docker container

Closely related to the port are active mode and passive mode.

Active mode: Port 21 is the default port of ftp and the control port of ftp, while port 20 is the data port of ftp, port 21 is used to receive client connections, and port 20 is used to transmit data; the server (actively) sets the rules that the client establishes a connection with the server, then through port 21, if you want to transmit data through port 20, the combination of port 20 and port 21 is the active mode of ftp

Passive mode: active mode has some security problems. If someone wants to attack your ftp service, they will go directly to port 20 to block you. In order to prevent data from being blocked, passive mode appears. The passive mode changes the 20 port of data transmission to a range, such as 21100-21110 above, and which value is determined by the client (for example, 21115). In this way, the outgoing data is not easy to be blocked, and the security is greatly improved. now most ftp clients use passive mode to connect to the server, that is, the port through which the data is transmitted by the client.

-e indicates additional parameters

FTP_USER is the ftp login user name, set the sample FTP_USER=zhaoolee

FTP_PASS is the ftp login password, set the sample FTP_PASS=eelooahz

PASV_ADDRESS is the public network ip. Set the example PASV_ADDRESS=104.243.20.148 (very important: the ip of the host must be bound here, otherwise the connection will not be connected. Zhaoolee has been here for a long time.)

The minimum port number of PASV_MIN_PORT for the client to connect to the server is 21100 (the lowest port number of the server in passive mode)

The maximum port number of PASV_MAX_PORT for the client to connect to the server is 21110 (the maximum port number of the server in passive mode)

-- name zhaoolee_vsftpd indicates that the container is named zhaoolee_vsftpd (this name can be customized)

-- restart=always indicates that restart can

Fauria/vsftpd stands for image name

Do a test with Aliyun

Open port 20, port 21, port segment 21100-21110

Create a container

Connection test (FillZilla download link: https://filezilla-project.org/download.php?type=client)

Upload files via ftp

Ftp is a commonly used service. Here, the docker method of vsftp is used to complete the construction, and one-line command is completed.

Docker image fauria/vsftpd open source address: https://github.com/fauria/docker-vsftpd, can find detailed operation documentation

These are all the contents of the article "how to build FTP Services in Docker". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report