Electron GUI App along with Python application


Hi Forum,

I have followed :

and I am able to start and see in my display the UI application.

But I have also a Python server application that runs in a forever loop and I would like to run it in the background.

I have tried to start the Python script first and the GUI app does not show in the display.

How can I start both the GUI app based on electron and the Python app in the background?

Thank you.


Hey nice!

Just as a heads up we have an example for balena + electronJS that might help you if you hit any blockers.

I assume you’re running this as a multicontainer application type, then you could have the application server run as a separate container, which also has the nice benefit that updating it wouldn’t stop your frontend :slight_smile:


Hi @robertgzr,

Thanks for your feedback.

I have the resin+Electron+React GUI application running ok in one container.
I was trying to add another application to this container (Python Server app) that will run in the background along with the GUI app.
But I can not make it work. Is this possible? I mean having 2 apps : one GUI and another like a server running together in the same container? or is necessary to create a docker compose to have a multi-container apps?



It should definitely be possible to run them alongside in the same container using something like http://supervisord.org

But yes the other option (and my personally preferred way of doing it - for the sake of maintainability) is to use docker-compose. You can follow our docs if for that as well: https://www.balena.io/docs/learn/develop/multicontainer/


Is there a simple kind of “Hello World” docker compose example using BalenaOS?



Check out this:


Is possible to communicate data between 2 different container apps running in the same BalenaOS host?
If yes How? What is the best practice?


You can refer to the official docker-compose documentation for most of these things:

Essentially all services you specify in your compose file will share a network and can reach each other by their names:

version: "2"
    build: .
      - "8000"
    image: postgres
      - "5432"

This enables the web service to talk to postgres via http://db:5432


Much appreciated @robertgzr

Thank you.


Also commenting more in the approach of running the GUI app and server app in the same container.

I have tried in my Dockerfile.template

CMD [“bash”, “/usr/src/app/start.sh”]

inside start.sh I have started both apps using a bash command like “gui_app && server_app” and vice versa but does not work.
How "supervisor: is different that just start both processes using a bash commandline?



I think you want to do

server_app &

to get server_app to run in the background

Using supervisord basically just adds a bunch of features that make it more pain free to manage. Like being able to restart one of the processes, starting additional ones, etc.



I will try that.

Thanks again.