FTP does not work from mesos docker container FTP does not work from mesos docker container docker docker

FTP does not work from mesos docker container


So my problem was really weird. But I've managed to fix this way.Quick answer: I was using alpakka ftp lib this way:

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

But using this way it works:

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

Longer answer: I started investigating alpakka lib and I've discovered that it uses the same lib that works for me during checking if file exists!

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

So I've started digging and it seems that most likely tahat setting passive mode to true was the solution. But it's weird because I've read that windows ftp server does not support passive mode...I hope someone could clarify my doubts one day, but at the moment I'm happy because it works :)


Not sure if its still helpful but I also got my ftp client transfering data from inside a Docker container after changing the data connection to passive. I think that active mode requires the client to have open ports which the server connects to when returning file listing results and during data transfer. However the client ports are not reachable from outside of the docker container since the requests are not routed through (like in a NAT:et network).

Found this post explaning active/passive FTP connections

https://labs.daemon.com.au/t/active-vs-passive-ftp/182