I'm testing out the new Azure IoT Edge V2. I need to run the Docker image deployed to the edge device with the --device option like this (to access a serial port):
$ docker run --device=/dev/serial/by-id/usb-ELT_SENSOR_EK100_V1.0_SN000001-if00-port0 olavt.azurecr.io/testco2sensor-arm32
How do I specify the --device
option when creating the new deployment from the Azure portal?
In theory you can specify anything documented in the docker api container create options stated here https://docs.docker.com/engine/api/v1.30/#operation/ContainerCreate
In the device case you could (I never tried it that way) specify in the createOptions
:
{
"HostConfig": {
"Devices": [
{
"PathOnHost": "/dev/serial/by-id/usb-ELT_SENSOR_EK100_V1.0_SN000001-if00-port0",
"PathInContainer": "/dev/serial/by-id/usb-ELT_SENSOR_EK100_V1.0_SN000001-if00-port0",
"CgroupPermissions": "rwm"
}
]
}
}
What works for sure it to privilege the container completely opening up everything on the hardware side. To do this you just use the Privileged
parameter. Note there is only one d in Privileged.
{
"HostConfig": {
"Privileged": true
}
}