Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Why does my NiFi ListenFTP in Docker container close connections from the host machine?

avatar
New Contributor

I am experiencing an issue with FTP access from the host machine to a Docker container. FTP access works when I try directly from within the container. I am unsure where the problem lies.

Context:

I am using Apache NiFi 2.0-M2 deployed in a Docker container. I have configured a ListenFTP processor in NiFi to receive files via FTP on port 2221 and make them accessible from the host machine.

nbo_0-1721222536715.png

 

docker-compose.yml

Here is my docker-compose.yml configuration:

services:
nifi:
container_name: nifi
image: apache/nifi:2.0.0-M2
ports:
  "8443:8443"
  "2221:2221" # ftp
environment:
  NIFI_WEB_HTTPS_PORT=8443

The port 2221 seems to be correctly mapped from the container to the host machine.

Connection Tests from the Host Machine:

Telnet:

telnet localhost 2221

Trying ::1... Connected to localhost. Escape character is '^]'. Connection closed by foreign host.

Netcat:

nc -zv localhost 2221

Connection to localhost port 2221 [tcp/rockwell-csp1] succeeded!

Curl:

curl -4 -v -u nbo:******* -T test2.txt ``ftp://localhost:2221

* Host localhost:2221 was resolved.

* IPv6: ::1
* IPv4: 127.0.0.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\*   Trying 127.0.0.1:2221...
* Connected to localhost (127.0.0.1) port 2221
* response reading failed (errno: 36)
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Closing connection
  curl: (56) response reading failed (errno: 36)

FTP:

ftp localhost 2221

Connected to localhost. 421 Service not available, remote server has closed connection

Summary:

Despite the configurations and resolution attempts mentioned above, the FTP connection consistently fails from the host machine with errors indicating that the server closes the connection immediately. The tests show that the port is accessible, but the NiFi ListenFTP server does not seem to accept or properly handle FTP connections from outside the container.

Many thanks in advance for your help.

Nicolas

1 REPLY 1

avatar
Community Manager

@nbo Welcome to the Cloudera Community!

To help you get the best possible solution, I have tagged our NiFi experts @MattWho @SAMSAL  who may be able to assist you further.

Please keep us updated on your post, and we hope you find a satisfactory solution to your query.


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: