2

I'm running a RPI zero (with raspbian as OS) and I would like to run some NodeJS applications. Therefore I have two applications: API and GUI. Both are nodeJS applications, so I would run them via npm run start.

But how do I run multiple applications at the same time?

I just started to use docker, but in this case (I'm using rpio to get access to the GPIO) I cannot access the GPIOs from inside of the docker containers. So my question is if I can run both applications at the same time without using docker.

1
  • As long as the applications are not using the same GPIOs this should not be a problem. WRT to multiple instances of node, they just need to use different ports (e.g., 80 and 8080).
    – goldilocks
    Commented Oct 6, 2018 at 12:11

1 Answer 1

1

First of all it`s correct, that you cannot granting GPIO access from inside of the docker Container as i know so far.

A Possible Workaround is to adding Parameters to the Dockerfile and to your application: Your Dockerfile should have an Entrypoint in the End like:

ENTRYPOINT ["./yourBinary","-gpioNumber"]

After this you should able to start a Docker Container with following command (after the image build of course):

1. API: docker run --privileged -d YourImageName -gpio=22 <--- for example
2. GUI: docker run --privileged -d YourImageName -gpio=24 <--- for example

As mention in the comment is it Possible as long you are not using the same GPIO. Heres a Documentation for Docker GPIO access https://blog.alexellis.io/gpio-on-swarm/

Thats one suggestion.

But to answering your Question, Yes! you can run multiple Application without Docker. How? As Example run your GUI and API application as process in a Background with the bg command https://www.computerhope.com/unix/ubg.htm

But as above descripted as long you won`t use the same GPIO port

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.