FTP从mesos docker容器不起作用

我有scala应用与akka蒸汽。 所以我的应用程序的stream程是这样的:

1. Check if file exists on FTP - I'm doing it with the org.apache.commons.net.ftp.FTPClient 2. If it exists stream it via alpakka library(and make some stream transformations) 

我的应用程序在本地工作,可以连接到服务器。

问题是当它被部署到dcos / mesos时。 我得到一个问题:

 java.io.IOException: /path/file.txt: No such file or directory 

我可以肯定地说那个文件在那里依然存在。 另外,当我尝试通过FTP本地连接从docker容器我有这样的事情:

 ftp> open some.ftp.address.com Connected to some.ftp.address.com. 220 Microsoft FTP Service Name (some.ftp.address.com:root): USER 331 Password required Password: 230 User logged in. Remote system type is Windows_NT. ftp> dir 501 Server cannot accept argument. ftp: bind: Address already in use ftp> 

所以我的问题真的很奇怪。 但我已经设法修复这种方式。 快速回答:我这样使用alpakka ftp lib:

 Ftp .fromPath(url, user, pass, Paths.get(s"/path/$fileName")) 

但使用这种方式它的工作原理:

 val ftpSettings = FtpSettings( host = InetAddress.getByName(url), port = 21, NonAnonFtpCredentials(user, pass), binary = true, passiveMode = true ) Ftp .fromPath(Paths.get(s"/path/$fileName"), ftpSettings) 

较长的回答:我开始调查alpakka lib,我发现在检查文件是否存在的时候,它使用了与我相同的lib。

 https://github.com/akka/alpakka/blob/master/ftp/src/main/scala/akka/stream/alpakka/ftp/impl/FtpOperations.scala 

所以我已经开始挖掘,似乎最有可能的是将被动模式设置为真实的解决scheme。 但是,这很奇怪,因为我读过Windows的FTP服务器不支持被动模式…我希望有人能澄清我的怀疑有一天,但目前我很高兴,因为它的工作:)