I’m trying to run FTP service using Apache ftpserver in docker container.
The container starts up with no issue and able to login in. However, it fails to make a data connection using passive mode.
So far it is running locally and external ip is not set so I would assume it grabs the internal local ip.
I tried with or without setting the external ip (setPassiveExternalAddress) no luck.
Did anyone successfully run Apache ftpserver with docker container?
java.net.BindException: Address in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method) ~[na:1.8.0_151]
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387) ~[na:1.8.0_151]
at java.net.Socket.bind(Socket.java:644) ~[na:1.8.0_151]
at org.apache.ftpserver.impl.IODataConnectionFactory.createDataSocket(IODataConnectionFactory.java:309) [ftpserver-core-1.1.1.jar:1.1.1]
at org.apache.ftpserver.impl.IODataConnectionFactory.openConnection(IODataConnectionFactory.java:257) [ftpserver-core-1.1.1.jar:1.1.1]
at org.apache.ftpserver.command.impl.LIST.execute(LIST.java:115) [ftpserver-core-1.1.1.jar:1.1.1]
at org.apache.ftpserver.impl.DefaultFtpHandler.messageReceived(DefaultFtpHandler.java:211) [ftpserver-core-1.1.1.jar:1.1.1]
at org.apache.ftpserver.listener.nio.FtpHandlerAdapter.messageReceived(FtpHandlerAdapter.java:62) [ftpserver-core-1.1.1.jar:1.1.1]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:858) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:947) [mina-core-2.0.16.jar:na]
at org.apache.ftpserver.listener.nio.FtpLoggingFilter.messageReceived(FtpLoggingFilter.java:85) [ftpserver-core-1.1.1.jar:1.1.1]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:947) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74) [mina-core-2.0.16.jar:na]
at org.apache.mina.filter.logging.MdcInjectionFilter.filter(MdcInjectionFilter.java:135) [mina-core-2.0.16.jar:na]
at org.apache.mina.filter.util.CommonEventFilter.messageReceived(CommonEventFilter.java:70) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:947) [mina-core-2.0.16.jar:na]
at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:398) [mina-core-2.0.16.jar:na]
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:234) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:947) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74) [mina-core-2.0.16.jar:na]
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63) [mina-core-2.0.16.jar:na]
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:770) [mina-core-2.0.16.jar:na]
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:762) [mina-core-2.0.16.jar:na]
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:704) [mina-core-2.0.16.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]
2
Answers
This Dockerfile works for me (see comments inside on how to use it)
Based on Orbiter’s configuration, I changed it to port 21. And also fixed a typo in his docker file.