1

I wrote a custom Azure IoT Edge module (Node.js) that needs to talk to a WebSocket server running on the host (not in a container).

How can I open the IoT Edge module container on port 9090 to allow for this communication?

Reneli
  • 1,756
  • 2
  • 16
  • 26

3 Answers3

3

I got this to work by adding this to my create options for my module in the deployment json file:

"createOptions": {
    "ExposedPorts": {
        "9090/tcp": {}
    }
}
Reneli
  • 1,756
  • 2
  • 16
  • 26
  • either we misunderstood your question is something is weird in your setup. You should not need to expose ports on your module for outbound communication. Opening ports is only required if you need to have inbound (opening) communication into your module – silent Nov 06 '19 at 08:15
1

The createOptions enables ingress where a process/container running on the host can talk to the module against the exposed port.

For egress to an endpoint on the host, there should be nothing needed. One can just use the hostIP:someport.

Cindy Xing
  • 46
  • 3
  • Thank you Cindy. In my use case was a WebSocket server on the host. With the `ExpostedPorts` I was able to connect and communicate with it from the module container. Without `ExposedPorts` I got a connection refused. – Reneli Oct 29 '19 at 03:12
-1

For outbound connectivity (from your module to some other endpoint), you do not need to configure anything on the module. That should work out of the box. There might, of course, be firewalls etc. running on your host.

silent
  • 14,494
  • 4
  • 46
  • 86