Port bindings at deployment manifest are not exposing ports

Omar Navarro 331 Reputation points
2022-02-15T15:22:15.237+00:00

We have a custom edge module in the deployment manifest but the port binds do not seem to be functioning. This syntax is similar to that of the blob storage module. Is this exposed port defined correctly with the following? Does another Docker setting require adjustment to expose port?

    "createOptions": {
        "HostConfig": {
            "LogConfig": {
                "Type": "json-file",
                "Config": {
                    "max-size": "10m",
                    "max-file": "3"
                }
            },
            "PortBindings": {
                "11009/tcp": [
                    {
                        "HostPort": "11009"
                    }
                ]
            }
        }
    }
Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
548 questions
Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
354 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,136 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sander van de Velde 29,691 Reputation points MVP
    2022-02-15T18:10:12.72+00:00

    Hello @Omar Navarro ,

    adding Container Create options is always tricky :-)

    It's good to know that "HostPort" is the port the container exposes on the host. This port has to be unique on the device, only one application (or container) can 'reserve' this port number.

    I recently added a custom module on GitHub exposing UDP communication:

    {  
        "ExposedPorts": {   
            "11001/udp":{}  
        },  
        "HostConfig": {  
            "PortBindings":{  
                "11001/udp":[   
                    {  
                        "HostPort":"11001"  
                    }  
                ]  
            }  
        }  
    }  
    

    Here, the internal port number is equal to the external (host) port number.

    0 comments No comments

0 additional answers

Sort by: Most helpful