I got my own built image/container running @ Raspberry Pi 4B+ (RPi) in docker.
It took me some effort to google/compose [for instance: 1 , 2] the correct list of parameters to be able to lauch it successfully:
docker run –device=/dev/mem –device=/dev/gpiomem -v /sys:/sys
–privileged –user=root –network=”host” –name=container_name image_name_or_id
I remember, even simplified version used to launch like a snap:
docker run –privileged –user=root –network=”host” –name=container_name image_name_or_id
Once this launched successfuly, I could stop my running container, start it again (even from VSCode GUI tool) and it would smootlhy boot up & run.
However, everytime I reboot my RPi (docker host), running those very same containers fails.
Moreover, launching new ones with the very same options as mentioned above fails as well.
Investing many hours trying all kinds of docker run options and combinations – when all of a sudden one of the attempts will result in a successful launch. But the same ‘magic spell’ won’t work next time after RPi reboot, or on another RPi.
This is the error output from docker container (using WiringPi library and C#/C++ code):
wiringPiISR: Can’t find gpio program wiringPiISR: unable to open
/sys/class/gpio/gpio23/value: No such file or directory
I know it sounds like a fairy tale – but I am just describing what I observed the last days.
It could be something I do fundamentally wrong, and I am ignorat about.
(Or, could it also be some hidden docker bug, that dis/appears randomly ?)
Any hint pointing to a stable solution (re-launchable docker container automatically after RPi restart) would be very much appreciated.