I’m running openhab 2.4 in a docker container on Raspberry Pi 4. When the full RPi server is restarted, then openHab can access the gpio pins without issues. But when only the openHab docker container is restarted, then the gpio interface is unavailable.
The log then shows this line:
2021-04-04 10:39:31.296 [ERROR] [ab.binding.gpio.internal.GPIOBinding] - Error occurred while creating backend object for item PushButton, exception: Device or resource busy
The problem is described here. But it is described for a non-Docker environment.
The workaround presented is to run the command below between the stop and start of openHab:
echo gpio_portnr > /sys/class/gpio/unexport
Is this the right way to address this problem? And if so, what is a correct way to configure the call to this command as part of a docker container start command? Should I tweak the container start command, which is currently standard:
gosu openhab tini -s ./start.sh
Thanks in advance for all help.