在github上找到了2个还算活跃的方案:
https://github.com/fauria/docker-vsftpd
https://github.com/stilliard/docker-pure-ftpd
方案一 https://github.com/fauria/docker-vsftpd
1、创建容器
docker run -d -v /my/data/directory:/home/vsftpd \ -p 20:20 -p 21:21 -p 21100-21110:21100-21110 \ -e FTP_USER=ftpuser -e FTP_PASS=ftpuser \ -e PASV_ADDRESS=10.186.62.118 \ --name vsftpd --restart=always fauria/vsftpd
默认是开启了FTP被动模式,在docker run指令中加入 -e PASV_ENABLE=NO 可以关闭被动模式(PASV)。 客户端工具如WinSCP, filezilla使用主动模式连接,但wget用的是被动模式
2、上传文件到 /home/vsftpd/ftpuser目录,使用客户端工具和wget测试成功
root@ubuntu:~$ wget ftp://ftpuser:[email protected]/actiontech-dble/ojdbc6.jar --2023-10-20 13:23:54-- ftp://ftpuser:*password*@10.186.62.118/actiontech-dble/ojdbc6.jar => ‘ojdbc6.jar.1’ Connecting to 10.186.62.118:21... connected. Logging in as ftpuser ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /actiontech-dble ... done. ==> SIZE ojdbc6.jar ... 2111220 ==> PASV ... done. ==> RETR ojdbc6.jar ... done. Length: 2111220 (2.0M) (unauthoritative) ojdbc6.jar.1 100%[==========================================================================>] 2.01M --.-KB/s in 0.02s 2023-10-20 13:23:54 (112 MB/s) - ‘ojdbc6.jar.1’ saved [2111220]
方案二 https://github.com/stilliard/docker-pure-ftpd
1、创建容器
ftp: container_name: ftpd image: stilliard/pure-ftpd:hardened volumes: - /data/docker-volumes/ftp/ftpusers:/home/ftpusers - /data/docker-volumes/ftp/pure-ftpd:/etc/pure-ftpd - /data/docker-volumes/ftp/pureftpd.conf:/etc/pureftpd.conf ports: - "21:21" - "30000-30059:30000-30059" environment: PUBLICHOST: 10.186.62.118 FTP_USER_NAME: ftpuser FTP_USER_PASS: ftpuser FTP_USER_HOME: /home/ftpusers privileged: true restart: always command: bash /run.sh --tls=0 -c 30 -C 10 -l puredb:/etc/pure-ftpd/pureftpd.pdb -P 10.186.62.118 -p 30000:30059 -E -j --dontresolve
如果要添加用户可以用命令:pure-pw useradd ftpuser -f /etc/pure-ftpd/passwd/pureftpd.passwd -m -u ftpuser -d /home/ftpusers/
2、上传文件到 /home/ftpusers/目录,使用客户端工具和wget测试成功
root@ubuntu:~$ wget ftp://ftpuser:[email protected]/actiontech-dble/ojdbc6.jar --2023-10-20 13:30:20-- ftp://ftpuser:*password*@10.186.62.118/actiontech-dble/ojdbc6.jar => ‘ojdbc6.jar.3’ Connecting to 10.186.62.118:21... connected. Logging in as ftpuser ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /actiontech-dble ... done. ==> SIZE ojdbc6.jar ... 2111220 ==> PASV ... done. ==> RETR ojdbc6.jar ... done. Length: 2111220 (2.0M) (unauthoritative) ojdbc6.jar.3 100%[==========================================================================>] 2.01M --.-KB/s in 0.02s 2023-10-20 13:30:20 (114 MB/s) - ‘ojdbc6.jar.3’ saved [2111220]
标签:ojdbc6,ftp,ftpuser,...,10.186,server,done,linux From: https://www.cnblogs.com/mmartin/p/17776867.html