I’m running a Node-RED container on Rpi Zero in order to use the rpi-led-control library (https://www.npmjs.com/package/rpi-led-control) but I am unable to use it because I get this error:
Error: EROFS: read-only file system, open '/sys/class/gpio/export'
I’m currently running the container in this way:
docker run -d -p 1880:1880 --group-add dialout --device=/dev/spidev0.0 --device=/dev/spidev0.1 --device=/dev/serial0 --user=root --restart=always -e NODE_OPTIONS="--max_old_space_size=256" --log-opt max-file=2 --log-opt max-size=2k -e TZ="Europe/Rome" braghettos/node-red:latest
My Dockerfile is the following:
FROM nodered/node-red:latest
USER root
RUN npm install node-red-node-serialport xbee-api node-red-contrib-xbee node-red-node-pi-gpiod node-red-contrib-telegrambot node-red-contrib-python-function node-red-node-twitter node-red-contrib-function-npm node-red-contrib-ibm-watson-iot onoff rpi-led-control node-red-contrib-play-audio
COPY ./config/settings.js /data/
RUN mkdir /cert
COPY ./cert/cert.pem /cert
COPY ./cert/key.pem /cert
RUN apk update && apk add py-pip
&& pip install requests plotly --upgrade
What I want to do is to interact with the SPI pins of the Rpi Zero GPIO from the Node-RED container.
Thanks in advance,
Diego
2
Answers
You need to mount gpio files/filesystem from the host during
docker run
like this:The exact file names varies for each Rpi device types, this if for Rpi Zero.
Use the docker run –privileged flag to give the container nearly all the same access to the host as processes running outside containers on the host: