I am developing an application for my Colibri i.MX7D module that is running a modified image of torizon-core-docker-colibri-imx7-emmc-Tezi_5.6.0+build.13 (changes to the device tree, not relevant here).
Development is done on Linux with Visual Studio Code and the Torizon extension.
My application starts a telnet server thread on port 50400 that listens to incoming connections by calling accept(). This succeeds without any errors (the same code is already used many times on desktop Linux systems). So far so good.
However, if I try to connect to this port from another machine with putty, I get the error “Connection Refused”. The used IP address is OK, I can ping to the module without any problem.
My understanding is that the docker container in which my application runs does not allow any connection from the outside. Searching on the Toradex site, the only post that seems to speak of this is An external ssh connection to a Debian container in Torizon? but that did not help me a lot…
Is there a simple way, in the Ports or Network keys in the Torizon extension for instance, to allow/connect a specific port to the outside world ?
I may be far off the real cause, this is my first application on a Toradex module so there is still a lot to learn an understand…
Any help is much appreciated !
Best regards,
Jeroen
My understanding is that the docker container in which my application runs does not allow any connection from the outside
From the Docker documentation: Newly created containers are connected to a default bridge network, which is isolated from the module network stack.
You can start the container with the host network mode: this way, the container shares the Colibri iMX7’s networking namespace and your application can communicate with other peers in the local network.
This mode is enabled when running docker run with parameter --network host. In our extension, all you need to do is create a new entry in the extraparms configuration with these options:
Just complementing my previous response, you can also achieve communication through port 50400 by just exposing it on the ports entry in the extension configurations, as described here: Torizon Best Practices Guide | Toradex Developer Center.
It is preferable doing this method rather than changing the network mode to host, which should be done only if really needed. Sorry for not explaining this sooner.