我正在尝试使用 Apache 客户端连接从 docker 映像部署的 FTP 服务器:
import org.apache.commons.net.ftp.FTPClient
import java.io.IOException
object FtpClient {
def main(args: Array[String]): Unit = {
val ftpClient = new FTPClient()
try {
ftpClient.connect("localhost", 21)
val success = ftpClient.login("one", "1234")
if (success) {
println("Success connect")
}
} catch {
case e: IOException => throw new RuntimeException(e)
} finally {
//
}
}
}
FTP 服务器运行者:
docker run -d -p 21:21 -p 21000-21010:21000-21010 -e USERS="one|1234" -e ADDRESS=ftp.site.domain delfer/alpine-ftp-server
我收到以下错误:
Exception in thread "main" java.lang.RuntimeException: org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
at ru.spb.client.FtpClient$.main(FtpClient.scala:23)
at ru.spb.client.FtpClient.main(FtpClient.scala)
Caused by: org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
at org.apache.commons.net.ftp.FTP.getReply(FTP.java:568)
at org.apache.commons.net.ftp.FTP.getReply(FTP.java:556)
编辑:
Docker 日志返回:
Changing password for one
New password:
Bad password: too short
Retype password:
adduser: /ftp/one: No such file or directory
passwd: password for one changed by root
seems like pidfd_open syscall does not work, falling back to
polling
failed to watch for direct child exit (pidfd_open error): Operation not permitted
也许我错过了一些重要的连接设置?