Search code examples
scaladockerftpakka-streamdcos

FTP does not work from mesos docker container


I have scala application with akka steams. So the flow of my application is like this:

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)

My application works locally and it can connect to the server.

The problem is when it is being deployed to dcos/mesos. I get an issue:

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

I can say for sure that file still exists there. Also when I try to connect from docker container locally through the ftp I've got something like this:

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> 

Solution

  • 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