I am busy with an IoT type application that requires physical hardware that is connected through a serial port. We have opted to use the Azure IoT Edge architecture to deploy the application on the PC that exists on premise. This helps our DevOps cycle.
To use Azure IoT Edge requires that our application is containerized and thus exposing serial ports can be quite a challenge. The PC is 64-bit and is running Ubuntu 20.04 and does have multiple USB, serial and LAN ports that we can plug devices into.
We have followed this great tutorial from Losant to set this up.
Our container creation options look like this:
{
"HostConfig": {
"PortBindings": {
"80/tcp": [
{
"HostPort": "5000"
}
]
},
"Privileged": true,
"Volumes": {
"/dev": {}
}
}
}
We map the application our application's port 80 to port 5000 on the PC and we set the Volumes and Privileged tag as suggested in the tutorial link above.
The device itself is connected through USB and thus we have had to install a driver on Ubuntu 20.04 from the FTDI website.
My question:
In some cases our application will find the serial port (tty/USB0), but in most cases it will not. If we power cycle the PC with the device connected the application usually finds the device. How can we change the PC setup / docker setup / application setup so that it always finds the device?
NOTE: This is a duplication of this question on StackOverflow as I was not sure whether the question belonged there or here.