I’ve been asked to comment in here by my colleagues. Unfortunately, I think there’s been some misunderstanding here. You should not have to use
host networking at all, as this binds a service to all host interfaces, which is usually not want you want in a multicontainer application.
The use of the
ports property in your
docker-compose.yml manifest is enough to open up the ports required for traffic ingress into the services it’s used on. In the case of your manifest, you’ve opened up port 8123 to map to port 8123 of traffic coming into your host. You should not start setting up any extra
iptables rules. The documentation in our FAQ is slightly out of date, and this precedes multicontainer applications (single service/container applications in balena always use
host networking). By default, your services in a multicontainer application are networked on a bridge which only allows internal traffic flow unless the ports keyword is used. As you have used it, you should be able to communicate with the services on port 8123.
When you say when you connect you get an ‘empty response’, what do you mean by this? If the port wasn’t opened, you’d see a ‘connection refused’ or similar error. For example:
curl -vv http://<hostname>:8123
(I’ve guessed a protocol here as HTTP, I don’t know what your service should actually be communicating in, but it will at least show up a connection refused error if there is one).
I note you’ve also got a service running something called
react which vaguely suggests to me this is a React service running a UI? As there are no opened ports for this service, only traffic between the
react service internal to the bridge will be available, and not to an external host.
Additionally, what kind of balena device is this, and are you trying on balenaCloud or on openBalena itself? If you’re new to balena, I’d strongly recommend starting on balenaCloud and getting to know the basics there first before launching into openBalena.
Have you followed the bridged networking example in the Services Masterclass to ensure that this works on your device? Alternatively, there’s a comprehensive Multicontainer Getting Started project here, which allows ingress of traffic into port 80 from the host to get live statistics on the device it’s installed on.