Azure IOT Edge Module deployment manifest file with privileged access for container with serial port access

Madanala, Jayashree 151 Reputation points
2022-09-21T15:00:35.59+00:00

Hi
I have a container, which i want to deploy as custom iot edge module. This module has a container that needs privileged access because we want to volume mount /dev of host system regarding serial ports.

Below is the snapshot of createOptions in deployment.json file where I defined Privileged as true for HostConfigs. Is this correct or some changes required. Also is it possible to provide privileged access only to particular file or directory example: /dev/ttyS0 . I want to expose serial port /dev/ttyS0

Please suggest and correct me, if correction required and share more info on this.

          "createOptions": {  
            "ExposedPorts": {  
              "12345/tcp": {},  
              "/dev/ttyS0":{}  
            },  
            "Env": [  
              "SAMPLE_PORT=12345",  
              "SERIAL_PORT=/dev/ttySO"  
            ],  
            "Volumes": {  
              "/dev": {}  
            },  
            "HostConfig": {  
              "Privileged": true,  
              "NetworkMode": "host",  
              "Binds": [  
                "app_dev-data:/dev:rw"  
              ],  
              "PortBindings": {  
                "12345/tcp": [  
                  {  
                    "HostIp": "",  
                    "HostPort": "12345"  
                  }  
                ]  
              }  
            },  
          }
Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
378 questions
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.
534 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. QuantumCache 20,031 Reputation points
    2022-09-21T19:45:44.063+00:00

    Hello @Madanala, Jayashree ,

    Yes, It is possible and should be preferred. See example on how to configure this:

    Configure create options

    247263-image.png

    I hope you have also followed this document: Link module storage to device storage for custom modules
    How to configure container create options for IoT Edge modules


  2. Sander van de Velde 28,386 Reputation points MVP
    2022-09-22T23:35:12.493+00:00

    Hello MadanalaJayashree-7313,

    In the past, I wrote this reference module for serial communication.

    In the readme, you see how we provided access to the ports.

    See also this blog post.